summaryrefslogtreecommitdiff
path: root/docs/users_guide/exts/stolen_syntax.rst
blob: 746daebd7c305333e5af3b4c70998b6e6a78e21f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.. _syntax-stolen:

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``
    .. index::
       single: forall

    Stolen (in types) by default (see :ref:`infelicities-lexical`). ``forall`` is
    a reserved keyword and never a type variable, in accordance with `GHC Proposal #43
    <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0043-forall-keyword.rst>`__.


``mdo``
    .. index::
       single: mdo

    Stolen by: :extension:`RecursiveDo`

``foreign``
    .. index::
       single: foreign

    Stolen by: :extension:`ForeignFunctionInterface`

``rec``, ``proc``, ``-<``, ``>-``, ``-<<``, ``>>-``, ``(|``, ``|)``
    .. index::
       single: proc

    Stolen by: :extension:`Arrows`

``?varid``
    .. index::
       single: implicit parameters

    Stolen by: :extension:`ImplicitParams`

``[|``, ``[e|``, ``[p|``, ``[d|``, ``[t|``, ``[||``, ``[e||``
    .. index::
       single: Quasi-quotes

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

``$(``, ``$$(``, ``$varid``, ``$$varid``
    .. index::
       single: Template Haskell

    Stolen by: :extension:`TemplateHaskell`

``[varid|``
    .. index::
       single: quasi-quotation

    Stolen by: :extension:`QuasiQuotes`

⟨varid⟩, ``#``\ ⟨char⟩, ``#``, ⟨string⟩, ``#``, ⟨integer⟩, ``#``, ⟨float⟩, ``#``, ⟨float⟩, ``##``
    Stolen by: :extension:`MagicHash`

``(#``, ``#)``
    Stolen by: :extension:`UnboxedTuples`

⟨varid⟩, ``!``, ⟨varid⟩
    Stolen by: :extension:`BangPatterns`

``pattern``
    Stolen by: :extension:`PatternSynonyms`

``static``
    Stolen by: :extension:`StaticPointers`