Options | Runtime | Use Show instance for results -- turned off is surprisingly unreliable

Anthony Clayden anthony.d.clayden at gmail.com
Tue Sep 21 12:33:02 UTC 2021


I usually have 'Use Show instance' switched off (aka use 'built-in
printer'), so I can see (at least in crude form) imported or 'system'
datatypes that don't have show instances/also it's a bit more revealing if
I get exceptions.

I have a datatype:

>    data Tree a = Empty
>            | Leaf a
>            | Node (Tree a) a (Tree a)
>            deriving (Eq, Show, Read)

For results of expressions that were `Node`s, the built-in printer just
ignored the first field. (`show`/print of those values works fine.)

>        FoldableTree>  myTree <> fdmap toUpper myTree
>        Node 'c' Empty

>        FoldableTree> print $ myTree <> fdmap toUpper myTree
>        Node (Node Empty 'A' (Node Empty 'C' (Leaf 'a'))) 'c' Empty


Most disconcerting until I realised what was going on. (Of course I don't
expect the built-in printer to produce pretty output).

AntC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/hugs-bugs/attachments/20210922/f71af287/attachment.html>


More information about the Hugs-Bugs mailing list