summaryrefslogtreecommitdiff
path: root/docs/users_guide/9.2.1-notes.rst
diff options
context:
space:
mode:
authorSebastian Graf <sgraf1337@gmail.com>2019-11-03 19:42:52 +0000
committerSebastian Graf <sebastian.graf@kit.edu>2021-03-12 11:01:09 +0100
commit27abfd0023589cb6ee3363512d160df2d1016275 (patch)
treee7a45b9557f6c4086cfe3197875454a6bf654889 /docs/users_guide/9.2.1-notes.rst
parentdf8e8ba267ffd7b8be0702bd64b8c39532359461 (diff)
downloadhaskell-wip/unlifted-data.tar.gz
Implement the UnliftedDatatypes extensionwip/unlifted-data
GHC Proposal: 0265-unlifted-datatypes.rst Discussion: https://github.com/ghc-proposals/ghc-proposals/pull/265 Issues: https://gitlab.haskell.org/ghc/ghc/-/issues/19523 Implementation Details: Note [Implementation of UnliftedDatatypes] This patch introduces the `UnliftedDatatypes` extension. When this extension is enabled, GHC relaxes the restrictions around what result kinds are allowed in data declarations. This allows data types for which an unlifted or levity-polymorphic result kind is inferred. The most significant changes are in `GHC.Tc.TyCl`, where `Note [Implementation of UnliftedDatatypes]` describes the details of the implementation. Fixes #19523.
Diffstat (limited to 'docs/users_guide/9.2.1-notes.rst')
-rw-r--r--docs/users_guide/9.2.1-notes.rst19
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/users_guide/9.2.1-notes.rst b/docs/users_guide/9.2.1-notes.rst
index de4a983001..b0f80e93c3 100644
--- a/docs/users_guide/9.2.1-notes.rst
+++ b/docs/users_guide/9.2.1-notes.rst
@@ -13,6 +13,7 @@ Language
<https://www.microsoft.com/en-us/research/publication/a-quick-look-at-impredicativity/>`__
(Serrano et al, ICFP 2020). More information here: :ref:`impredicative-polymorphism`.
This replaces the old (undefined, flaky) behaviour of the :extension:`ImpredicativeTypes` extension.
+
* The first stage of the `Pointer Rep Proposal`_ has been implemented. All
boxed types, both lifted and unlifted, now have representation kinds of
the shape ``BoxedRep r``. Code that references ``LiftedRep`` and ``UnliftedRep``
@@ -20,6 +21,24 @@ Language
.. _Pointer Rep Proposal: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0203-pointer-rep.rst
+* :extension:`UnliftedDatatypes`: The `Unlifted Datatypes Proposal`_ has been
+ implemented. That means GHC Haskell now offers a way to define algebraic
+ data types with strict semantics like in OCaml or Idris! The distinction to
+ ordinary lifted data types is made in the kind system: Unlifted data types
+ live in kind ``TYPE (BoxedRep Unlifted)``. :extension:`UnliftedDatatypes`
+ allows giving data declarations such result kinds, such as in the following
+ example with the help of :extension:`StandaloneKindSignatures`: ::
+
+ type IntSet :: UnliftedType -- type UnliftedType = TYPE (BoxedRep Unlifted)
+ data IntSet = Branch IntSet !Int IntSet | Leaf
+
+ See :extension:`UnliftedDatatypes` for what other declarations are
+ possible. Slight caveat: Most functions in ``base`` (including ``$``)
+ are not levity-polymorphic (yet) and hence won't work with unlifted
+ data types.
+
+.. _Unlifted Datatypes Proposal: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0265-unlifted-datatypes.rst
+
* Kind inference for data/newtype instance declarations is slightly
more restrictive than before. See the user manual :ref:`kind-inference-data-family-instances`.
This is a breaking change, albeit a fairly obscure one that corrects a specification bug.