debugging - Implementing show for multi-line content in Haskell -
i have small matrix type in haskell is appropriately displayed across multiple lines. current implementation of show
formats matrices this:
matfromrows [[1,2] ,[3,4]]
this works on own (ie seeing contents of matrix in ghci
), whenever matrix displayed part of larger structure, generates awkwardly formatted , difficult read content. example, tuple (matfromrows [[1, 2], [3, 4]], matfromrows [[5, 6], [7, 8]])
display as
(matfromrows [[1,2] ,[3,4]],matfromrows [[5,6] ,[7,8]]
what graceful way handle show
ing multi-line content in haskell, formatting isn't destroyed when display part of larger structure?
Comments
Post a Comment