[GHC] #8080: Typechecking error: "Could not deduce (m ~ m1)..."

GHC ghc-devs at haskell.org
Sun Jul 21 18:01:54 CEST 2013


#8080: Typechecking error: "Could not deduce (m ~ m1)..."
-------------------------------------+-------------------------------------
       Reporter:  abacabadabacaba    |             Owner:
           Type:  bug                |            Status:  new
       Priority:  normal             |         Milestone:
      Component:  Compiler (Type     |           Version:  7.6.3
  checker)                           |  Operating System:  Unknown/Multiple
       Keywords:                     |   Type of failure:  GHC rejects
   Architecture:  Unknown/Multiple   |  valid program
     Difficulty:  Unknown            |         Test Case:
     Blocked By:                     |          Blocking:
Related Tickets:                     |
-------------------------------------+-------------------------------------
 This program:
 {{{
 import Control.Monad

 f x = let
   g y = let
     h z = liftM not x
     in h 0
   in g 0
 }}}
 is expected to compile. Instead, it produces an error:
 {{{
 test.hs:5:21:
     Could not deduce (m ~ m1)
     from the context (Monad m)
       bound by the inferred type of f :: Monad m => m Bool -> m Bool
       at test.hs:(3,1)-(7,8)
     or from (m Bool ~ m1 Bool, Monad m1)
       bound by the inferred type of
                h :: (m Bool ~ m1 Bool, Monad m1) => t1 -> m1 Bool
       at test.hs:5:5-21
       `m' is a rigid type variable bound by
           the inferred type of f :: Monad m => m Bool -> m Bool
           at test.hs:3:1
       `m1' is a rigid type variable bound by
            the inferred type of
            h :: (m Bool ~ m1 Bool, Monad m1) => t1 -> m1 Bool
            at test.hs:5:5
     Expected type: m1 Bool
       Actual type: m Bool
     In the second argument of `liftM', namely `x'
     In the expression: liftM not x
     In an equation for `h': h z = liftM not x
 }}}

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




More information about the ghc-tickets mailing list