Commit b355b8fc authored by Ben Gamari's avatar Ben Gamari 🐢
Browse files

users-guide: Add since annotations for language extensions

Based off of
https://ghc.haskell.org/trac/ghc/wiki/LanguagePragmaHistory.
parent 4dbc31b8
......@@ -330,6 +330,8 @@ Negative literals
.. ghc-flag:: -XNegativeLiterals
:since: 7.8.1
Enable the use of un-parenthesized negative numeric literals.
The literal ``-123`` is, according to Haskell98 and Haskell 2010,
......@@ -349,6 +351,8 @@ Fractional looking integer literals
.. ghc-flag:: -XNumDecimals
:since: 7.8.1
Allow the use of floating-point literal syntax for integral types.
Haskell 2010 and Haskell 98 define floating literals with the syntax
......@@ -365,6 +369,8 @@ Binary integer literals
.. ghc-flag:: -XBinaryLiterals
:since: 7.10.1
Allow the use of binary notation in integer literals.
Haskell 2010 and Haskell 98 allows for integer literals to be given in
......@@ -654,6 +660,8 @@ Pattern synonyms
.. ghc-flag:: -XPatternSynonyms
:since: 7.8.1
Allow the definition of pattern synonyms.
Pattern synonyms are enabled by the flag :ghc-flag:`-XPatternSynonyms`, which is
......@@ -1289,6 +1297,8 @@ Applicative do-notation
.. ghc-flag:: -XApplicativeDo
:since: 8.0.1
Allow use of ``Applicative`` ``do`` notation.
The language option :ghc-flag:`-XApplicativeDo` enables an alternative translation for
......@@ -1745,6 +1755,8 @@ New monadic failure desugaring mechanism
.. ghc-flag:: -XMonadFailDesugaring
:since: 8.0.1
Use the ``MonadFail.fail`` instead of the legacy ``Monad.fail`` function
when desugaring refutable patterns in ``do`` blocks.
......@@ -1776,6 +1788,7 @@ must not conflict with any Prelude module.)
.. ghc-flag:: -XRebindableSyntax
:implies: :ghc-flag:`-XNoImplicitPrelude`
:since: 7.0.1
Enable rebinding of a variety of usually-built-in operations.
......@@ -1911,6 +1924,8 @@ Lambda-case
.. ghc-flag:: -XLambdaCase
:since: 7.6.1
Allow the use of lambda-case syntax.
The :ghc-flag:`-XLambdaCase` flag enables expressions of the form ::
......@@ -1935,6 +1950,8 @@ Empty case alternatives
.. ghc-flag:: -XEmptyCase
:since: 7.8.1
Allow empty case expressions.
The :ghc-flag:`-XEmptyCase` flag enables case expressions, or lambda-case
......@@ -1981,6 +1998,8 @@ Multi-way if-expressions
.. ghc-flag:: -XMultiWayIf
:since: 7.6.1
Allow the use of multi-way-``if`` syntax.
With :ghc-flag:`-XMultiWayIf` flag GHC accepts conditional expressions with
......@@ -2149,6 +2168,8 @@ Explicit namespaces in import/export
.. ghc-flag:: -XExplicitNamespaces
:since: 7.6.1
Enable use of explicit namespaces in module export lists.
In an import or export list, such as ::
......@@ -2352,6 +2373,8 @@ Data type contexts
.. ghc-flag:: -XDatatypeContexts
:since: 7.0.1
Allow contexts on ``data`` types.
Haskell allows datatypes to be given contexts, e.g. ::
......@@ -3196,6 +3219,8 @@ Traditional record syntax
.. ghc-flag:: -XNoTraditionalRecordSyntax
:since: 7.4.1
Disallow use of record syntax.
Traditional record syntax, such as ``C {f = x}``, is enabled by default.
......@@ -3280,6 +3305,7 @@ Duplicate record fields
.. ghc-flag:: -XDuplicateRecordFields
:implies: :ghc-flag:`-XDisambiguateRecordFields`
:since: 8.0.1
Allow definition of record types with identically-named fields.
......@@ -4098,6 +4124,8 @@ Deriving ``Lift`` instances
.. ghc-flag:: -XDeriveLift
:since: 8.0.1
Enable automatic deriving of instances for the ``Lift`` typeclass for
Template Haskell.
......@@ -4347,6 +4375,8 @@ Deriving any other class
.. ghc-flag:: -XDeriveAnyClass
:since: 7.10.1
Allow use of any typeclass in ``deriving`` clauses.
With :ghc-flag:`-XDeriveAnyClass` you can derive any other class. The compiler
......@@ -4594,6 +4624,8 @@ Nullary type classes
.. ghc-flag:: -XNullaryTypeClasses
:since: 7.8.1
Allows the use definition of type classes with no parameters. This flag
has been replaced by :ghc-flag:`-XMultiParamTypeClasses`.
......@@ -5452,6 +5484,8 @@ Instance signatures: type signatures in instance declarations
.. ghc-flag:: -XInstanceSigs
:since: 7.6.1
Allow type signatures for members in instance definitions.
In Haskell, you can't write a type signature in an instance declaration,
......@@ -5587,6 +5621,8 @@ Overloaded labels
.. ghc-flag:: -XOverloadedLabels
:since: 8.0.1
Enable use of the ``#foo`` overloaded label syntax.
GHC supports *overloaded labels*, a form of identifier whose interpretation may
......@@ -5672,6 +5708,8 @@ Overloaded lists
.. ghc-flag:: -XOverloadedLists
:since: 7.8.1
Enable overloaded list syntax (e.g. desugaring of lists via the
``IsList`` class).
......@@ -5837,6 +5875,8 @@ Undecidable (or recursive) superclasses
.. ghc-flag:: -XUndecidableSuperClasses
:since: 8.0.1
Allow all superclass constraints, including those that may result in
non-termination of the typechecker.
......@@ -6756,6 +6796,7 @@ Injective type families
.. ghc-flag:: -XTypeFamilyDependencies
:implies: :ghc-flag:`-XTypeFamilies`
:since: 8.0.1
Allow functional dependency annotations on type families. This allows one to
define injective type families.
......@@ -6883,6 +6924,7 @@ Kind polymorphism
.. ghc-flag:: -XPolyKinds
:implies: :ghc-flag:`-XKindSignatures`
:since: 7.4.1
Allow kind polymorphic types.
......@@ -7199,6 +7241,8 @@ Datatype promotion
.. ghc-flag:: -XDataKinds
:since: 7.4.1
Allow promotion of data types to kind level.
This section describes *data type promotion*, an extension to the kind
......@@ -7582,6 +7626,8 @@ The ``Constraint`` kind
.. ghc-flag:: -XConstraintKinds
:since: 7.4.1
Allow types of kind ``Constraint`` to be used in contexts.
Normally, *constraints* (which appear in types to the left of the ``=>``
......@@ -7707,6 +7753,8 @@ Ambiguous types and the ambiguity check
.. ghc-flag:: -XAllowAmbiguousTypes
:since: 7.8.1
Allow type signatures which appear that they would result in
an unusable binding.
......@@ -8960,6 +9008,8 @@ Partial Type Signatures
.. ghc-flag:: -XPartialTypeSignatures
:since: 7.10.1
Type checker will allow inferred types for holes.
A partial type signature is a type signature containing special
......@@ -9064,6 +9114,8 @@ Named Wildcards
.. ghc-flag:: -XNamedWildCards
:since: 7.10.1
Allow naming of wildcards (e.g. ``_x``) in type signatures.
Type wildcards can also be named by giving the underscore an identifier
......@@ -9439,6 +9491,7 @@ Syntax
.. ghc-flag:: -XTemplateHaskell
:implies: :ghc-flag:`-XTemplateHaskellQuotes`
:since: 8.0.1
Enable Template Haskell's splice and quotation syntax.
......@@ -10693,6 +10746,8 @@ Static pointers
.. ghc-flag:: -XStaticPointers
:since: 7.10.1
Allow use of static pointer syntax.
The language extension :ghc-flag:`-XStaticPointers` adds a new syntactic form
......@@ -12420,6 +12475,8 @@ Role annotations
.. ghc-flag:: -XRoleAnnotations
:since: 7.8.1
Allow role annotation syntax.
Sometimes the programmer wants to constrain the inference process. For
......@@ -12518,6 +12575,8 @@ Strict-by-default data types
.. ghc-flag:: -XStrictData
:since: 8.0.1
Make fields of data types defined in the current module strict by default.
Informally the ``StrictData`` language extension switches data type
......@@ -12545,6 +12604,7 @@ Strict-by-default pattern bindings
.. ghc-flag:: -XStrict
:implies: :ghc-flag:`-XStrictData`
:since: 8.0.1
Make bindings in the current module strict by default.
......
......@@ -639,6 +639,8 @@ In summary, Safe Haskell consists of the following three language flags:
.. ghc-flag:: -XSafe
:since: 7.2.1
Restricts the module to the safe language. All of the module's
direct imports must be trusted, but the module itself need not
reside in a trusted package, because the compiler vouches for its
......@@ -652,6 +654,8 @@ In summary, Safe Haskell consists of the following three language flags:
.. ghc-flag:: -XTrustworthy
:since: 7.2.1
This establishes that the module is trusted, but the guarantee is
provided by the module's author. A client of this module then
specifies that they trust the module author by specifying they trust
......@@ -671,6 +675,8 @@ In summary, Safe Haskell consists of the following three language flags:
.. ghc-flag:: -XUnsafe
:since: 7.4.1
Mark a module as unsafe so that it can't be imported by code
compiled with :ghc-flag:`-XSafe`. Also enable the Safe Import extension so that a
module can require
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment