[GHC] #12918: Make DefaultSignatures more particular about their types on the RHS of a context

GHC ghc-devs at haskell.org
Mon Jan 30 19:02:49 UTC 2017


#12918: Make DefaultSignatures more particular about their types on the RHS of a
context
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  simonpj
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.0.2-rc1
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #12784            |  Differential Rev(s):  Phab:D2983
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"7363d5380e600e2ef868a069d5df6857d9e5c17e/ghc"
 7363d538/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="7363d5380e600e2ef868a069d5df6857d9e5c17e"
 Check that a default type signature aligns with the non-default signature

 Before, GHC was extremely permissive about the form a default type
 signature could take on in a class declaration. Notably, it would accept
 garbage like this:

   class Monad m => MonadSupply m where
     fresh :: m Integer
     default fresh :: MonadTrans t => t m Integer
     fresh = lift fresh

 And then give an extremely confusing error message when you actually
 tried to declare an empty instance of MonadSupply. We now do extra
 validity checking of default type signatures to ensure that they align
 with their non-default type signature counterparts. That is, a default
 type signature is allowed to differ from the non-default one only in its
 context - they must otherwise be alpha-equivalent.

 Fixes #12918.

 Test Plan: ./validate

 Reviewers: goldfire, simonpj, austin, bgamari

 Reviewed By: bgamari

 Subscribers: mpickering, dfeuer, thomie

 Differential Revision: https://phabricator.haskell.org/D2983

 GHC Trac Issues: #12918
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12918#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list