[commit: ghc] ghc-8.0: Describe symptoms of (and the cure for) #12768 in 8.0.2 release notes (411bd2d)

git at git.haskell.org git at git.haskell.org
Thu Nov 10 21:42:35 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/411bd2dfed3d6cfe73cd0e4521acee67f18a8fe7/ghc

>---------------------------------------------------------------

commit 411bd2dfed3d6cfe73cd0e4521acee67f18a8fe7
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Sun Nov 6 09:40:48 2016 -0500

    Describe symptoms of (and the cure for) #12768 in 8.0.2 release notes
    
    GHC 8.0.2 introduced a bugfix involving GeneralizedNewtypeDeriving in
    96d451450923a80b043b5314c5eaaa9d0eab7c56. This made typechecking of
    GND-produced code a bit stricter, and an unfortunate side effect of this was
    that there were a couple of corner-case programs that stopped compiling
    when transitioning from GHC 8.0.1 to 8.0.2.
    
    Since the number of affected programs seems quite small, and since the fix
    is so straightforward, we opt to simply note this discrepancy in the 8.0.2
    release notes.
    
    Resolves #12768.
    
    (cherry picked from commit ead83db8a7db772a9f248af9767a4283218a5c9f)


>---------------------------------------------------------------

411bd2dfed3d6cfe73cd0e4521acee67f18a8fe7
 docs/users_guide/8.0.2-notes.rst | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst
index 2986e38..727e919 100644
--- a/docs/users_guide/8.0.2-notes.rst
+++ b/docs/users_guide/8.0.2-notes.rst
@@ -25,6 +25,23 @@ Language
    presence of :ghc-flag:`-XRebindableSyntax` and
    :ghc-flag:`-XOverloadedStrings` (:ghc-ticket:`12688`).
 
+-  GHC is now a bit more strict in typechecking code generated by
+   :ghc-flag:`-XGeneralizedNewtypeDeriving`. For example, GHC will now reject
+   this program: ::
+
+      class C m where
+        foo :: C m => m ()
+
+      newtype N m a = N (m a)
+        deriving C -- This is now an error
+
+   This is in contrast to GHC 8.0.1 and earlier, which would accept this code.
+   To fix this code, simply remove the ``C m`` constraint from ``foo``, as it
+   is wholly unnecessary: ::
+
+      class C m where
+        foo :: m ()
+
 -  Some programs using :ghc-flag:`-XDefaultSignatures` that incorrectly
    type-checked in GHC 8.0.1 are now rejected by GHC 8.0.2. See
    :ghc-ticket:`12784` for details.



More information about the ghc-commits mailing list