[Haskell-cafe] Pragmas (was: ANNOUNCE: haskell-src-exts 0.4.4)

Roman Cheplyaka roma at ro-che.info
Mon Dec 8 04:37:25 EST 2008

* Neil Mitchell <ndmitchell at gmail.com> [2008-12-08 08:29:03+0000]
> > Apart from this, HSE now also parses any unrecognized pragma in option
> > (e.g. LANGUAGE), declaration (e.g. RULES) or expression (e.g. SCC)
> > position, allowing user-customized pragmas. Unrecognized pragmas in
> > other positions will (unfortunately) give a parse error. If this ever
> > means a problem for you - let me know!
> This is likely to be a problem for me :-)
> I certainly have OPTIONS_DERIVE and CATCH pragmas that I've inserted
> into various programs over time. I think failing on an unrecognised
> pragma is probably a bad idea, when ignoring a pragma is usually
> perfectly safe.

Even more,
    An implementation is not required to respect any pragma, but the pragma
    should be ignored if an implementation is not prepared to handle it.[1]

Related question: why does not Language.Haskell.Syntax[2] (from haskell-src)
represent comments or pragmas in any way?

  1. http://www.haskell.org/onlinereport/pragmas.html
  2. http://www.haskell.org/ghc/docs/latest/html/libraries/haskell-src/Language-Haskell-Syntax.html
Roman I. Cheplyaka :: http://ro-che.info/
"Don't let school get in the way of your education." - Mark Twain

More information about the Haskell-Cafe mailing list