6.1.3. Summary of stolen syntax

Turning on an option that enables special syntax might cause working Haskell 98 code to fail to compile, perhaps because it uses a variable name which has become a reserved word. This section lists the syntax that is “stolen” by language extensions. We use notation and nonterminal names from the Haskell 98 lexical syntax (see the Haskell 98 Report). We only list syntax changes here that might affect existing working programs (i.e. “stolen” syntax). Many of these extensions will also enable new context-free syntax, but in all cases programs written to use the new syntax would not be compilable without the option enabled.

There are two classes of special syntax:

  • New reserved words and symbols: character sequences which are no longer available for use as identifiers in the program.

  • Other special syntax: sequences of characters that have a different meaning when this particular option is turned on.

The following syntax is stolen:

forall

Stolen (in types) by default (see Lexical syntax). forall is a reserved keyword and never a type variable, in accordance with GHC Proposal #193.

mdo

Stolen by: RecursiveDo

foreign

Stolen by: ForeignFunctionInterface

rec, proc, -<, >-, -<<, >>-, (|, |)

Stolen by: Arrows

?varid

Stolen by: ImplicitParams

[|, [e|, [p|, [d|, [t|, [||, [e||

Stolen by: QuasiQuotes. Moreover, this introduces an ambiguity with list comprehension syntax. See the discussion on quasi-quoting for details.

$(, $$(, $varid, $$varid

Stolen by: TemplateHaskell

[varid|

Stolen by: QuasiQuotes

⟨varid⟩, #⟨char⟩, #, ⟨string⟩, #, ⟨integer⟩, #, ⟨float⟩, #, ⟨float⟩, ##

Stolen by: MagicHash

⟨integer⟩, #(Int|Word)(8|16|32|64)?

Stolen by: ExtendedLiterals

(#, #)

Stolen by: UnboxedTuples

⟨varid⟩, !, ⟨varid⟩

Stolen by: BangPatterns

pattern

Stolen by: PatternSynonyms

static

Stolen by: StaticPointers