#4355: Coud not deduce (Typeable a) from context (Typeable a, …)
---------------------------------+------------------------------------------
    Reporter:  maltem            |       Owner:                         
        Type:  bug               |      Status:  new                    
    Priority:  normal            |   Component:  Compiler (Type checker)
     Version:  7.1               |    Keywords:                         
    Testcase:                    |   Blockedby:                         
          Os:  Unknown/Multiple  |    Blocking:                         
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown           
---------------------------------+------------------------------------------
 Attached is a module containing code from XMonadContrib that does not
 type-check anymore with ghc 7.0.1 rc1. I tried to strip the code somewhat
 down; at least it only depends on base and mtl. Here's the (somewhat
 irritating) error message:

 {{{
 tcBug.hs:50:30:
     Could not deduce (Typeable a)
       from the context (Typeable a, Show ts, HList ts a, LayoutClass l a)
       arising from a use of `fromMessage'
     Possible fix:
       add (Typeable a) to the context of the instance declaration
     In a stmt of a pattern guard for
                  an equation for `handleMessage':
         Just (Toggle t) <- fromMessage m
     In an equation for `handleMessage':
         handleMessage mt m
           | Just (Toggle t) <- fromMessage m,
             i@(Just _) <- find (transformers mt) t
           = case currLayout mt of {
               EL l det
                 -> do { l' <- fromMaybe l
                             `fmap`
                               handleMessage l (SomeMessage
 ReleaseResources);
                         .... }
                 where
                     cur = (i == currIndex mt) }
           | otherwise
           = case currLayout mt of {
               EL l det
                 -> fmap (fmap (\ x -> mt {currLayout = EL x det}))
                  $ handleMessage l m }
     In the instance declaration for `LayoutClass (MultiToggle ts l) a'

 tcBug.hs:51:25:
     Could not deduce (HList ts a)
       from the context (Typeable a,
                         Show ts,
                         HList ts a,
                         LayoutClass l a,
                         Transformer t a)
       arising from a use of `find'
     Possible fix:
       add (HList ts a) to the context of
         the data constructor `Toggle'
         or the instance declaration
     In a stmt of a pattern guard for
                  an equation for `handleMessage':
         i@(Just _) <- find (transformers mt) t
     In a stmt of a pattern guard for
                  an equation for `handleMessage':
         Just (Toggle t) <- fromMessage m
     In an equation for `handleMessage':
         handleMessage mt m
           | Just (Toggle t) <- fromMessage m,
             i@(Just _) <- find (transformers mt) t
           = case currLayout mt of {
               EL l det
                 -> do { l' <- fromMaybe l
                             `fmap`
                               handleMessage l (SomeMessage
 ReleaseResources);
                         .... }
                 where
                     cur = (i == currIndex mt) }
           | otherwise
           = case currLayout mt of {
               EL l det
                 -> fmap (fmap (\ x -> mt {currLayout = EL x det}))
                  $ handleMessage l m }
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4355>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to