6.1.1. Controlling extensions¶
Language extensions can be controlled (i.e. allowed or not) in two ways:
- Every language extension can be switched on by a command-line flag
“
-X...
” (e.g.-XTemplateHaskell
), and switched off by the flag “-XNo...
”; (e.g.-XNoTemplateHaskell
). - Language extensions can also be enabled using the
LANGUAGE
pragma, thus{-# LANGUAGE TemplateHaskell #-}
(see LANGUAGE pragma).
-
Haskell2010
¶ Compile Haskell 2010 language variant. Enables the following language extensions:
EmptyDataDecls
ForeignFunctionInterface
PatternGuards
DoAndIfThenElse
RelaxedPolyRec
-
Haskell98
¶ Compile using Haskell 98 language variant. Enables the following language extensions:
Although not recommended, the deprecated -fglasgow-exts
flag enables
a large swath of the extensions supported by GHC at once.
-
-fglasgow-exts
¶ The flag
-fglasgow-exts
is equivalent to enabling the following extensions: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.