Treatment of unknown pragmas

Ben Gamari ben at smart-cactus.org
Thu Oct 25 20:32:46 UTC 2018


Niklas Larsson <metaniklas at gmail.com> 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 --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20181025/6a6f039e/attachment.sig>


More information about the ghc-devs mailing list