Richard is spot on. Meanwhile, do open a ticket on this. Maybe someone else will jump in to help.
Do give a step-by-step way to reproduce the problem. Simon | -----Original Message----- | From: ghc-devs [mailto:[email protected]] On Behalf Of | Richard Eisenberg | Sent: 09 May 2014 05:25 | To: George Roldugin | Cc: [email protected] | Subject: Re: GHC not parsing TH pretty printed code | | Well, the problem isn't quite that the semicolon is expected before the | second line -- it's that the semicolon is interpreted as separating let- | definitions, not do-statements. | | For example, the following works: | | bar = do {let {x = 5}; | return x} | | Looking quickly through the TH's pretty-printer code, there seem to be | several places where problems like this might arise, due to lack of | braces or too many of them. | | What to do? If you're blocked by this issue, just edit the pretty- | printer code. The code is actually quite straightforward. Get the | sources | (https://ghc.haskell.org/trac/ghc/wiki/Building/GettingTheSources), | prep your machine | (https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation), and build. | Given that TH has changed since the 7.8 release, I recommend saying | `sync-all checkout ghc-7.8` to get the 7.8 branch before building. | | After building, do some sanity checks to make sure your hand-built GHC | is working. | | Then, just edit libraries/template-haskell/Language/Haskell/TH/Ppr.hs | until things work. In particular, I bet adding a call to `braces` on | line 150 will go a long way here. | | Even if we fixed the bug you reported, that bugfix would be in HEAD, | where TH is different than in 7.8. It's possible it would be merged for | 7.8.3, but my guess is that you don't want to wait that long. | | I hope this helps! | Richard | | On May 9, 2014, at 12:08 AM, George Roldugin <[email protected]> | wrote: | | > Hi all, | > | > I've hit a problem with GHC 7.8 where the code pretty printed by | Template Haskell fails to parse. | > | > The problem is with the placement of explicit semicolons in place of | indentation. | > | > The following code pretty printed by TH won't parse: | > | > bar = do {let x = 5; | > return x} | > | > | > GHC expects the following placement of semicolons: | > | > bar = do {let x = 5 | > ; return x} | > | > | > I reported this bug and included sample TH code to reproduce the | problem here: | > https://ghc.haskell.org/trac/ghc/ticket/9022 | > | > I rely on compiling code constructed with TH for my thesis project. | > | > Is there a work around I could use besides going back to GHC 7.6? | > | > Cheers, | > George | > _______________________________________________ | > ghc-devs mailing list | > [email protected] | > http://www.haskell.org/mailman/listinfo/ghc-devs | | _______________________________________________ | ghc-devs mailing list | [email protected] | http://www.haskell.org/mailman/listinfo/ghc-devs _______________________________________________ ghc-devs mailing list [email protected] http://www.haskell.org/mailman/listinfo/ghc-devs
