Treatment of unknown pragmas

Simon Marlow marlowsd at
Fri Oct 26 07:01:12 UTC 2018

What pragma syntax should other Haskell compilers use? I don't think it's
fair for GHC to have exclusive rights to the pragma syntax form the report,
and other compilers should not be relegated to using {-# X-FOOHC ... #-}.
But now we have all the same issues again.


On Thu, 25 Oct 2018 at 21:32, Ben Gamari <ben at> wrote:

> Niklas Larsson <metaniklas at> writes:
> > Hi!
> >
> > Why not follow the standard in that pragmas were intended for all
> > tools consuming Haskell ...
> That much isn't clear to me. The Report defines the syntax very
> specifically to be for "compiler pragmas" to be used by "compiler
> implementations". I personally consider "the compiler" to be something
> different from tools like HLint.
> Of course, on the other hand it also specified that implementations
> should ignore unknown pragmas, so the original authors clearly didn't
> anticipate that non-compiler tooling would be so common.
> > ... and not for GHCs exclusive use?
> > All that would require is to make the warning opt-in.
> >
> Disabling the unknown pragma warning by default would mean that users
> not be warned if they mis-spelled LANGAGE or INILNE, which could result
> in frustrating error messages for the uninitiated. It seems to me that
> we should try to avoid this given just how common these pragmas are in
> practice.
> Finally, in general I think it would be generally useful to have a
> properly namespaced syntax for tooling pragmas. Afterall, we otherwise
> end up with tools claiming random bits of syntax, resulting in an
> unnecessarily steep learning curve and potentially
> syntactically-colliding tools.
> Cheers,
> - Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list