[Haskell] Read Instances for Data.Map and Data.Set

Tomasz Zielonka tomasz.zielonka at gmail.com
Mon Oct 24 08:58:03 EDT 2005

On 10/21/05, Simon Marlow <simonmar at microsoft.com> wrote:
> I rather think that this should be an explicit design requirement for
> Read/Show instances in the libraries, along with the requirement that
> the Show instance outputs valid Haskell syntax that can be included in a
> program (assuming appropriate imports, and possibly an appropriate type
> signature).  Show is not for pretty-printing, it is for serialising.

BTW, I noticed with slight horror that Data.Tree.Tree gained labeled
fields in GHC 6.4, and of course they are included in the output of
derived Show. This makes Tree's show'ed in 6.4 unreadable in earlier
versions of GHC (like 6.2.2). Also, such represenation is too lenghty IMO.

Perhaps rootLabel and subForest could be ordinary functions (but
this could break someones code), or we could use a hand-written Show
instance, showing without labels and reading both versions?

Best regards

More information about the Libraries mailing list