Open sjakobi opened 5 years ago
Also note the incorrect representation of the second '"'
Char
as '" '
! The first one is actually fine.
@sjakobi Thanks for reporting this. Could you give the whole code used to produce x
?
My guess is that this happens because pretty-simple
doesn't have any support for reading Haskell-style single characters (like 'a'
), but it does have support for reading strings (like "foobar"
), so what is happening here is that '"' ... '"'
actually gets interpreted as something like ' "'some string that starts and ends with a single quote'" '
.
Here are two related issues. I imagine solving either of them would also solve this problem, if you'd like to take a shot at it:
'a'
: https://github.com/cdepillabout/pretty-simple/issues/45I tried looking into this a little more. Here's my reproduction of this issue:
You can see that everything after the final )
gets lost. This happens because pretty-simple
has no support for Haskell characters (#45), and it doesn't support non-balanced brackets very well (#27).
I'd happily accept fixes for either of these! I imagine #45 should be particularly easy to fix.
Could you give the whole code used to produce
x
?
stack.yaml
to use this prettyprinter
version.stack repl
, run> app = App (Var (V "f" 0)) (TextLit (Chunks [] "\n")) :: Expr () ()
> x = diag $ unAnnotate $ prettyExpr app
Thanks for the quick response! I'll try to look for alternative packages first, but may come back if I don't find anything better! :)
BTW I don't understand the new title. There's no unbalanced parenthesis here – it's apparently just that the characters are misparsed.
There's no unbalanced parenthesis here – it's apparently just that the characters are misparsed.
Ah, so like I said in https://github.com/cdepillabout/pretty-simple/issues/52#issuecomment-557365228, this is caused because of #45 and #27.
The unbalanced parenthesis are happening because there is no smart parsing for Haskell characters. However, if the unbalanced parenthesis thing was fixed, then at least all the characters would be output, even if there is no pretty-printing of them.
Also note the incorrect representation of the second
'"'
Char
as'" '
! The first one is actually fine.
This is fixed as of v3.2.0.0, probably due to https://github.com/cdepillabout/pretty-simple/commit/0b95aecb420c631942726d4beb6fc68f8a6a3641. :)
Sorry for the large example!
The
Union
constructor has two fields, butpPrintNoColor
shows only the first!