Open Profpatsch opened 2 years ago
The previous show instance would add another layer of quoting for each nesting:
ghci> show (rcons (#foo := "bar") rnil) "[(\"foo\",\"\\\"bar\\\"\")]"
Instead, what we want is to display a nicely readable variant of the record, using the infix field syntax for both label/value pairs and full records:
ghci> show (rcons (#hi := (rcons (#lea := "hi") rnil)) (rcons (#foo := "bar") rnil )) "[#foo := \"bar\",#hi := [(#lea := \"hi\")]]" ghci> show (#hi := "lea") "#hi := \"lea\""
That’s better!
Note that we can’t have a roundtripping Read instance anyway, so we might as well have Show be readable.
Read
Show
Fixes https://github.com/agrafix/superrecord/issues/36
This includes the changes from #35
Note that
ghci> show (FldProxy @"ab cd ef" := "lea") "#ab cd ef := \"lea\""
So in that case we might want to have a special case? Thoughts?
The previous show instance would add another layer of quoting for each nesting:
Instead, what we want is to display a nicely readable variant of the record, using the infix field syntax for both label/value pairs and full records:
That’s better!
Note that we can’t have a roundtripping
Read
instance anyway, so we might as well haveShow
be readable.Fixes https://github.com/agrafix/superrecord/issues/36
This includes the changes from #35