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).

GHC blesses a number of extensions, beyond Haskell 2010, to be suitable to turned on by default. These extensions are considered to be stable and conservative.

GHC2021 is used by GHC if neither Haskell98 nor Haskell2010 is turned on explicitly. Since later versions of GHC may use a later GHC20xx by default, users are advised to declare the language set explicitly with -XGHC2021.

The GHC2021 language set comprises the following extensions:


Compile Haskell 2010 language variant. Enables the following language extensions:


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.


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.