haskell / happy

The Happy parser generator for Haskell
Other
291 stars 84 forks source link

Internal Happy errors are not helpful #241

Closed Kleidukos closed 2 months ago

Kleidukos commented 2 years ago

The Internal Happy error exception gives a CallStack that is most unhelpful, as it only gives the location of the error function used in the generated code. This could be slightly improved by having HasCallStack pragmas earlier in the program.

Moreover, more information about has failed would be appreciated. Currently I get

λ❯ runAlex "let example = 42" parseMiniML 
*** Exception: Internal Happy error

CallStack (from HasCallStack):
  error, called at /home/hecate/Code/Compiler Experiments/qamar/dist-newstyle/build/x86_64-linux/ghc-9.2.4/qamar-0.1.0.0/build/Parser.hs:1441:17 in qamar-0.1.0.0-inplace:Parser

and it's quite unbecoming.

sgraf812 commented 2 months ago

Frankly, if you see this error then there's a bug in happy that you should report. You can't do anything about it and you are not using happy in a wrong way (at least I don't think that you are).

Did you see this error in conjunction with -XStrictData? Then this issue the same as #273, for which I provide a fix in #289.

Kleidukos commented 2 months ago

Yes it must have been in conjunction with -XStrictData. See https://gist.github.com/heitor-lassarote/9cc4203990352f5df5f6b84da9291df9?permalink_comment_id=4306546#gistcomment-4306546