Table of Contents
As with all known Haskell systems, GHC implements some extensions to the language. They are all enabled by options; by default GHC understands only plain Haskell 98.
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. Leaving out all of them gives you standard Haskell 98.
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:
-XPrintExplicitForalls
,
-XForeignFunctionInterface
,
-XUnliftedFFITypes
,
-XGADTs
,
-XImplicitParams
,
-XScopedTypeVariables
,
-XUnboxedTuples
,
-XTypeSynonymInstances
,
-XStandaloneDeriving
,
-XDeriveDataTypeable
,
-XFlexibleContexts
,
-XFlexibleInstances
,
-XConstrainedClassMethods
,
-XMultiParamTypeClasses
,
-XFunctionalDependencies
,
-XMagicHash
,
-XPolymorphicComponents
,
-XExistentialQuantification
,
-XUnicodeSyntax
,
-XPostfixOperators
,
-XPatternGuards
,
-XLiberalTypeSynonyms
,
-XExplicitForAll
,
-XRankNTypes
,
-XImpredicativeTypes
,
-XTypeOperators
,
-XDoRec
,
-XParallelListComp
,
-XEmptyDataDecls
,
-XKindSignatures
,
-XGeneralizedNewtypeDeriving
,
-XTypeFamilies
.
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.