Syntax extensions (was: RE: The Future of Haskell discussionat
the Haskell Workshop)
Simon Marlow
simonmar at microsoft.com
Wed Sep 17 13:07:27 EDT 2003
> {-# LANGUAGE <specification> #-}
>
> where <specification> is one or more (if compatible) of keywords like
>
> Haskell98 Pure Haskell 98, no extensions.
> SharedExtenisons (Haskell02???) A set of agreed-upon extensions
> implemented by all "major"
> Haskell systems.
> RecursiveDo
> ArrowSyntax
> TemplateHaskell
> OverlappingInstances
> UndecidableInstances
> FFI Foreign Function
Interface
> MPTC Multi-parameter Type Classes
Looks fine to me. A few things to think about:
- Some of the keywords specify an entire language (eg. Haskell98),
whereas some are language modifiers (eg. FFI). We might want
to make a distinction. Currently GHC supports only Haskell98 +
modifiers.
- Are extensions always additive? Are there any extensions
which are incompatible?
- There are features you might want to *disable*. eg.
GHC lets you turn off the monomorphism restriction.
Perhaps something like this:
{-# LANGUAGE Haskell98 +FFI -MonomorphismRestriction #-}
> (abbreviations used when three or more words).
>
> The OPTION pragma would be used for compiler-specific
> options, although,
> in the interest of supporting portable code without having to
> resort to
> preprocessing using CPP, maybe it would make sense to provide
>
> OPTIONS-GHC
> OPTIONS-Hugs
> OPTIONS-NHC
> ...
>
> as well, the idea being that a compiler/interpreter then only
> would look at options pertinent to itself.
Yes, I've been meaning to rename GHC's version of the pragma to
GHC_OPTIONS for some time.
Cheers,
Simon
More information about the Haskell
mailing list