[GHC] #7854: Constrained method type accepted in Haskell 98 mode

GHC ghc-devs at haskell.org
Wed Mar 4 13:45:43 UTC 2015


#7854: Constrained method type accepted in Haskell 98 mode
-------------------------------------+-------------------------------------
        Reporter:  refold            |                   Owner:  thomie
            Type:  bug               |                  Status:  closed
        Priority:  normal            |               Milestone:  7.12.1
       Component:  Compiler (Type    |                 Version:  7.6.3
  checker)                           |                Keywords:  newcomer
      Resolution:  fixed             |            Architecture:
Operating System:  Unknown/Multiple  |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:
      Blocked By:                    |  module/mod39
 Related Tickets:  #10118, #10119    |                Blocking:
                                     |  Differential Revisions:  Phab:D688
-------------------------------------+-------------------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"3aa2519ec29156f57a862a033bc7a902b742a2e0/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="3aa2519ec29156f57a862a033bc7a902b742a2e0"
 Check for equality before deferring

 This one was a bit of a surprise. In fixing Trac #7854, I moved
 the checkAmbiguity tests to checkValidType. That meant it happened
 even for monotypes, and that turned out to be very expensive in
 T9872a, for reasons described in this (new) Note in TcUnify:

     Note [Check for equality before deferring]
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     Particularly in ambiguity checks we can get equalities like (ty ~ ty).
     If ty involves a type function we may defer, which isn't very
 sensible.
     An egregious example of this was in test T9872a, which has a type
 signature
            Proxy :: Proxy (Solutions Cubes)
     Doing the ambiguity check on this signature generates the equality
        Solutions Cubes ~ Solutions Cubes
     and currently the constraint solver normalises both sides at vast
 cost.
     This little short-cut in 'defer' helps quite a bit.

 I fixed the problem with a quick equality test, but it feels like an ad-
 hoc
 solution; I think we might want to do something in the constraint solver
 too.

 (The problem was there all along, just more hidden.)
 }}}

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


More information about the ghc-tickets mailing list