[GHC] #10338: GHC Forgets Constraints

GHC ghc-devs at haskell.org
Fri Apr 24 19:48:42 UTC 2015


#10338: GHC Forgets Constraints
-------------------------------------+-------------------------------------
        Reporter:  crockeea          |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.8.3
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Well all the GHCs I have say
 {{{
 T10338a.hs:27:26:
     Could not deduce (Unsat c Double) arising from a use of `qux'
     from the context (C c z, Monad rnd, Num z)
       bound by the type signature for
                  foo :: (C c z, Monad rnd, Num z) => v -> rnd (c z)
       at T10338a.hs:26:8-69
 }}}
 And that is totally correct.  Every call to `qux` gives rise to a
 constraint `QCtx t q`. Nothing provides that constraint, certainly not `C
 c z`.  But in fact the instance for `Qux t` says that `QCtx t q`
 simplifies to `Unsat t q`.  And we are stuck.

 (The call to `qux` also gives rise to a `Qux c` constraint, and that is
 indeed satisfied from the `C c z` superclass.)

 I'm at a loss for why you think this program should typecheck.

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


More information about the ghc-tickets mailing list