[commit: ghc] ghc-8.0: Give concrete example for #12784 in 8.0.2 release notes (dae7690)

git at git.haskell.org git at git.haskell.org
Sun Dec 18 21:26:38 UTC 2016


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

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

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

commit dae769049f67fdc3aff92cb828206d4c68faa2cf
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Tue Dec 6 09:03:41 2016 -0500

    Give concrete example for #12784 in 8.0.2 release notes
    
    Summary:
    We mentioned that there were "some programs" that failed to typecheck
    due to #12784, but given how surprisingly common this issue has been, it'd
    be prudent to at least give one example of the bug in the release notes.
    
    Reviewers: simonpj, bgamari, austin, rwbarton
    
    Reviewed By: rwbarton
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2786
    
    GHC Trac Issues: #12784
    
    (cherry picked from commit eec02ab7c8433465cc8d6be0a8889e7c6a222fb0)


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

dae769049f67fdc3aff92cb828206d4c68faa2cf
 docs/users_guide/8.0.2-notes.rst | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst
index fa7aa8d..237c3b9 100644
--- a/docs/users_guide/8.0.2-notes.rst
+++ b/docs/users_guide/8.0.2-notes.rst
@@ -68,8 +68,25 @@ Language
         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.
+   type-checked in GHC 8.0.1 are now rejected by GHC 8.0.2. Here is a
+   characteristic example: ::
+
+      class Monad m => MonadSupply m where
+        fresh :: m Integer
+        default fresh :: (MonadTrans t, MonadSupply m) => t m Integer
+        fresh = lift fresh
+
+      instance MonadSupply m => MonadSupply (IdentityT m)
+
+   Note that the ``m`` in the default type signature is being used in
+   a completely different way than the ``m`` in the non-default signature!
+   We can fix this (in a backwards-compatible way) like so: ::
+
+      class Monad m => MonadSupply m where
+        fresh :: m Integer
+        default fresh :: (MonadTrans t, MonadSupply m', m ~ t m') => m Integer
+                         -- Same 'm Integer' after the '=>'
+        fresh = lift fresh
 
 -  Some programs which combine default type class method implementations and
    overlapping instances may now fail to type-check. Here is an example: ::



More information about the ghc-commits mailing list