Hi everyone,

Recently Neil Mitchell opened a pull request [1] proposing a single-line
change: Adding `{-# HLINT ... #-}` to the list of pragmas ignored by the
lexer. I'm a bit skeptical of this idea. Afterall, adding cases to the
lexer for every tool that wants a pragma seems quite unsustainable.

On the other hand, a reasonable counter-argument could be made on the
basis of the Haskell Report, which specifically says that
implementations should ignore unrecognized pragmas. If GHC did this
(instead of warning, as it now does) then this wouldn't be a problem.

Of course, silently ignoring mis-typed pragmas sounds terrible from a
usability perspective. For this reason I proposed that the following
happen:

 * The `{-# ... #-}` syntax be reserved in particular for compilers (it
   largely already is; the Report defines it as "compiler pragma"
   syntax). The next Report should also allow implementations to warn in
   the case of unrecognized pragmas.

 * We introduce a "tool pragma" convention (perhaps even standardized in
   the next Report). For this we can follow the model of Liquid Haskell:
   `{-@ $TOOL_NAME ... @-}`.

Does this sound sensible?

Cheers,

- Ben


[1] https://github.com/ghc/ghc/pull/204

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell

Reply via email to