simple Haskell help needed on #19746

Richard Eisenberg rae at
Wed Apr 28 02:12:49 UTC 2021

> On Apr 27, 2021, at 3:32 PM, Sebastian Graf <sgraf1337 at> wrote:
> Hi Richard,
> Maybe I lack a bit of context, but I don't see why you wouldn't choose (3).
> Extending the lexer/parser will yield a declarative specification of what exactly constitutes a GHC_OPTIONS pragma (albeit in a language that isn't Haskell) and should be more efficient than `reads`, even if you fix it to scale linearly. Plus, it seems that's what we do for other pragmas such as RULE already.

(3) is tempting indeed. There are two problems:

A. The code that parses strings isn't actually declarative. See In particular note the comment: "This stuff is horrible. I hates it." Evidently written by Simon M in 2003 with the introduction of alex.

B. We need this code outside the lexer, to deal with e.g. :set in GHCi.

> On Apr 27, 2021, at 4:28 PM, Iavor Diatchki <iavor.diatchki at> wrote:
> ... gather ...

Aha! That was the magic incantation I needed but did not have. Many thanks, Iavor.

The curious can see for the final result.


More information about the ghc-devs mailing list