Coud not deduce (Typeable a) from context (Typeable a, …)
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 }
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |