summaryrefslogtreecommitdiff
path: root/docs/users_guide/8.4.1-notes.rst
diff options
context:
space:
mode:
authorDavid Feuer <david.feuer@gmail.com>2017-03-30 13:30:52 -0400
committerDavid Feuer <David.Feuer@gmail.com>2017-03-30 13:30:54 -0400
commit69f070d8e4d6043937e3405675ac911448bfcb44 (patch)
tree022823fcccf914836dfd804e2facfd977492a8fa /docs/users_guide/8.4.1-notes.rst
parentff7094e5a80435ff68490c725029e762913a72d3 (diff)
downloadhaskell-69f070d8e4d6043937e3405675ac911448bfcb44.tar.gz
Deriving for phantom and empty types
Make `Functor`, `Foldable`, and `Traversable` take advantage of the case where the type parameter is phantom. In this case, * `fmap _ = coerce` * `foldMap _ _ = mempty` * `traverse _ x = pure (coerce x)` For the sake of consistency and especially simplicity, make other types with no data constructors behave the same: * `fmap _ x = case x of` * `foldMap _ _ = mempty` * `traverse _ x = pure (case x of)` Similarly, for `Generic`, * `to x = case x of` * `from x = case x of` Give all derived methods for types without constructors appropriate arities. For example, ``` compare _ _ = error ... ``` rather than ``` compare = error ... ``` Fixes #13117 and #13328 Reviewers: austin, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: ekmett, RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3374
Diffstat (limited to 'docs/users_guide/8.4.1-notes.rst')
-rw-r--r--docs/users_guide/8.4.1-notes.rst78
1 files changed, 78 insertions, 0 deletions
diff --git a/docs/users_guide/8.4.1-notes.rst b/docs/users_guide/8.4.1-notes.rst
new file mode 100644
index 0000000000..4470bb9e79
--- /dev/null
+++ b/docs/users_guide/8.4.1-notes.rst
@@ -0,0 +1,78 @@
+.. _release-8-4-1:
+
+Release notes for version 8.4.1
+===============================
+
+The significant changes to the various parts of the compiler are listed in the
+following sections. There have also been numerous bug fixes and performance
+improvements over the 8.2.1 release.
+
+
+Highlights
+----------
+
+The highlights, since the 8.2.1 release, are:
+
+- Many, many bug fixes.
+
+Full details
+------------
+
+Language
+~~~~~~~~
+
+Compiler
+~~~~~~~~
+
+- Derived ``Functor``, ``Foldable``, and ``Traversable`` instances are now
+optimized when their last type parameters have phantom roles. Specifically, ::
+
+ fmap _ = coerce
+ traverse _ x = pure (coerce x)
+ foldMap _ _ = mempty
+
+These definitions of ``foldMap`` and ``traverse`` are lazier than
+the ones we would otherwise derive, as they may produce results without
+inspecting their arguments at all.
+
+See also :ref:`deriving-functor`, :ref:`deriving-foldable`, and
+:ref:`deriving-traversable`.
+
+- Derived ``Functor``, ``Foldable``, ``Traversable``, ``Generic``, and
+``Generic1`` instances now have better, and generally better-documented,
+behaviors for types with no constructors. In particular, ::
+
+ fmap _ x = case x of
+ foldMap _ _ = mempty
+ traverse _ x = pure (case x of)
+ to x = case x of
+ to1 x = case x of
+ from x = case x of
+ from1 x = case x of
+
+The new behavior generally leads to more useful error messages than the
+old did, and lazier semantics for ``foldMap`` and ``traverse``.
+
+- Derived instances for types with no constructors now have appropriate
+arities: they take all their arguments before producing errors. This may not
+be terribly important in practice, but it seems like the right thing to do.
+Previously, we generated ::
+
+ (==) = error ...
+
+Now we generate ::
+
+ _ == _ = error ...
+
+- Lots of other bugs. See `Trac
+ <https://ghc.haskell.org/trac/ghc/query?status=closed&milestone=8.4.1&col=id&col=summary&col=status&col=type&col=priority&col=milestone&col=component&order=priority>`_
+ for a complete list.
+
+Runtime system
+~~~~~~~~~~~~~~
+
+Template Haskell
+~~~~~~~~~~~~~~~~
+
+``ghc`` library
+~~~~~~~~~~~~~~~