[Haskell-cafe] compiler "pragma"'s

Erik Hesselink hesselink at gmail.com
Sat Sep 10 11:32:13 CEST 2011


On Fri, Sep 9, 2011 at 23:41, Vasili I. Galchin <vigalchin at gmail.com> wrote:
>    Is there a list of compiler pragmas? Specifically I am looking at how to
> specify more than one type variable in a class definition. Also I have
> forgotten the "meta syntax" for specifying a pragma ... some kind of Haskell
> comment?

If you're using GHC, there is a list of language extensions in the
user's guide chapter 7 [1]. Specifically, 7.13 specifies the language
pragma's. To turn on a language extension, you use the LANGUAGE pragma
with the specific extension(s) you want. In this case, you want
MultiParamTypeClasses, section 7.6.1.1. So the exact syntax will be:

{-# LANGUAGE MultiParamTypeClasses #-}

Put this at the top of your source file.

Note that the link is to the documentation for the latest version of
GHC (7.2.1 as of this writing). There are also links to specific
version, that might be more appropriate depending on the version of
GHC you have.

Erik

[1] http://haskell.org/ghc/docs/latest/html/users_guide/ghc-language-features.html



More information about the Haskell-Cafe mailing list