Table of Contents
As with all known Haskell systems, GHC implements some extensions to the language. They can all be enabled or disabled by commandline flags or language pragmas. By default GHC understands the most recent Haskell version it supports, plus a handful of extensions.
Some of the Glasgow extensions serve to give you access to the underlying facilities with which we implement Haskell. Thus, you can get at the Raw Iron, if you are willing to write some non-portable code at a more primitive level. You need not be “stuck” on performance because of the implementation costs of Haskell's “high-level” features—you can always code “under” them. In an extreme case, you can write all your time-critical code in C, and then just glue it together with Haskell!
Before you get too carried away working at the lowest level (e.g.,
sloshing MutableByteArray#
s around your
program), you may wish to check if there are libraries that provide a
“Haskellised veneer” over the features you want. The
separate libraries
documentation describes all the libraries that come with GHC.
The language option flags control what variation of the language are permitted.
Language options can be controlled in two ways:
Every language option can switched on by a command-line flag "-X...
"
(e.g. -XTemplateHaskell
), and switched off by the flag "-XNo...
";
(e.g. -XNoTemplateHaskell
).
Language options recognised by Cabal can also be enabled using the LANGUAGE
pragma,
thus {-# LANGUAGE TemplateHaskell #-}
(see Section 7.13.1, “LANGUAGE pragma”).
The flag -fglasgow-exts
is equivalent to enabling the following extensions:
-XForeignFunctionInterface
,
-XUnliftedFFITypes
,
-XImplicitParams
,
-XScopedTypeVariables
,
-XUnboxedTuples
,
-XTypeSynonymInstances
,
-XStandaloneDeriving
,
-XDeriveDataTypeable
,
-XDeriveFunctor
,
-XDeriveFoldable
,
-XDeriveTraversable
,
-XDeriveGeneric
,
-XFlexibleContexts
,
-XFlexibleInstances
,
-XConstrainedClassMethods
,
-XMultiParamTypeClasses
,
-XFunctionalDependencies
,
-XMagicHash
,
-XPolymorphicComponents
,
-XExistentialQuantification
,
-XUnicodeSyntax
,
-XPostfixOperators
,
-XPatternGuards
,
-XLiberalTypeSynonyms
,
-XRankNTypes
,
-XTypeOperators
,
-XDoRec
,
-XParallelListComp
,
-XEmptyDataDecls
,
-XKindSignatures
,
-XGeneralizedNewtypeDeriving
.
Enabling these options is the only
effect of -fglasgow-exts
.
We are trying to move away from this portmanteau flag,
and towards enabling features individually.