Jules Bean schrieb:
> Dmitri O.Kondratiev wrote:
>> I am trying to define instance Show[MyType] so
>> show (x:xs :: MyType) would return a single string where substrings
>> corresponding to list elements will be separated by "\n".
>> This would allow pretty printing of MyType list in several lines
>> instead of one, as default Show does for lists.
> 
> You're doing it wrong.
> 
> Show is not for pretty-printing.

(+1)

> Show is for the production of haskell syntax for debugging and
> copy-pasting into test cases, as well as for use with 'Read'.
> 
> If you want to pretty print, use a different function name.

Maybe related:
   http://www.haskell.org/haskellwiki/List_instance

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to