> \begin{code}
> module Exh3 where
> class Monad m => StateMonad s m where
>    getState :: m s
> 
> setState0 :: forall b.(StateMonad (a,b) m => m a)
> setState0 = getState >>= \ (l,_r) -> return l
> \end{code}
> 
> yields:  TcType.lhs:313: Non-exhaustive patterns in lambda

You're good at finding these bugs!

GHC was confused by the parens round the inner type.
If you remove them, GHC complains that the context is ambiguous:
it mentions 'b' which is not mentioned in the type after the '=>'.
This is the right error; crashing is wrong!

I'm fixing it as we speak.

Thanks for reporting this.  Explicit for-alls havn't been beaten on as
throughly as the rest of the compiler.

Simon

Reply via email to