6.1.1. Controlling extensions — Glasgow Haskell Compiler 9.0.1 User's Guide

# 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:

  `ImplicitPrelude` `StarIsType` `CUSKs` `MonomorphismRestriction` `DatatypeContexts` `TraditionalRecordSyntax` | `EmptyDataDecls` `ForeignFunctionInterface` `PatternGuards` `DoAndIfThenElse` `RelaxedPolyRec`

`Haskell98`

  Compile using Haskell 98 language variant. Enables the following language extensions:

  `ImplicitPrelude` `StarIsType` `CUSKs` `MonomorphismRestriction` | `NPlusKPatterns` `DatatypeContexts` `TraditionalRecordSyntax` `NondecreasingIndentation`

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:

  `ConstrainedClassMethods` `DeriveDataTypeable` `DeriveFoldable` `DeriveFunctor` `DeriveGeneric` `DeriveTraversable` `EmptyDataDecls` `ExistentialQuantification` `ExplicitNamespaces` `FlexibleContexts` `FlexibleInstances` `ForeignFunctionInterface` `FunctionalDependencies` `GeneralizedNewtypeDeriving` `ImplicitParams` `InterruptibleFFI` | `KindSignatures` `LiberalTypeSynonyms` `MagicHash` `MultiParamTypeClasses` `ParallelListComp` `PatternGuards` `PostfixOperators` `RankNTypes` `RecursiveDo` `ScopedTypeVariables` `StandaloneDeriving` `TypeOperators` `TypeSynonymInstances` `UnboxedTuples` `UnicodeSyntax` `UnliftedFFITypes`

  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.