Type checker fails to recognize equality
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE KindSignatures #-}
module Test where
import qualified Control.Monad.State as S
class HasConns (m :: * -> *) where
type Conn m
foo :: (HasConns m, Monad m) => S.StateT (Conn m) m ()
foo =
do _ <- S.get
return ()
This fails to compile with GHC 7.10.2:
Could not deduce (S.MonadState (Conn m) (S.StateT (Conn m) m))
arising from a use of ‘S.get’
from the context (HasConns m, Monad m)
bound by the type signature for
foo :: (HasConns m, Monad m) => S.StateT (Conn m) m ()
It compiles with GHC 7.8.4, though. Adding "Conn m ~ Conn m" to the type context of foo lets it compile again. This seems not right to me.
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |