-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show Rec
produces nested escaping
#36
Comments
Profpatsch
added a commit
to possehl-analytics/superrecord
that referenced
this issue
Nov 10, 2022
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. Fixes agrafix#36
Profpatsch
added a commit
to possehl-analytics/superrecord
that referenced
this issue
Nov 10, 2022
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. Fixes agrafix#36
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think there is an extra layer of
show
there that shouldn’t be.Some people say
Show
should roundtrip withRead
, but I don’t see how it’s possible with Superrecord anyway.The text was updated successfully, but these errors were encountered: