[GHC] #13332: Report unrecognized pragmas earlier

GHC ghc-devs at haskell.org
Mon Apr 3 16:33:22 UTC 2017


#13332: Report unrecognized pragmas earlier
-------------------------------------+-------------------------------------
        Reporter:  crockeea          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by mpickering):

 * keywords:  newcomer =>


Comment:

 I investigated this today.

 The relevant code path starts in `ghc/Main.hs` under the comment "do the
 business" which catches and displays errors. Warnings on the other hand
 are dealt with by `runHsc` and are already baked into the `HscMonad`. The
 main logic of how the parser and type checker link together is in
 `hscTypecheck`. The typechecker is invoked by the `tcRnModule` function
 but wrapped with `ioMsgMaybe` which throws
 an error if the typechecker fails.

 It seems like the best solution would be to also stop using `throwIO` to
 report errors and also bake them into the `Hsc` type so that `runHsc`
 deals with throwing both warnings and exceptions so we can isolate the
 logic and which are displayed into one place. I fear that this would be
 quite a difficult change as a lot of the compiler is designed using these
 unchecked exceptions.

 Thanks for looking at this Richard but I agree that it's not very easy to
 fix properly.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13332#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list