Type error: Expected type: T. Actual type T ???

wren ng thornton wren at freegeek.org
Sun Oct 30 02:29:19 CEST 2011

On 10/29/11 7:33 PM, Brandon Allbery wrote:
> On Sat, Oct 29, 2011 at 16:18, Bas van Dijk<v.dijk.bas at gmail.com>  wrote:
>> type Run t = ∀ n β. Monad n ⇒ t n β → n (St t β)
>> foo :: (Monad m, MonadTransControl t) =>  (Run t ->  m α) ->  t m α
>> foo f = liftControl f
>> Type checking 'foo' this gives the following error:
>>     Couldn't match expected type `Run t' with actual type `Run t'
> I *think* this might be odd reporting combined with an expected behavior:
>   since the forall is embedded in the "type" declaration, the "t" inside the
> parens is not the same as the one outside (because each one has its own
> "forall" associated with it).

But t is an argument to the type alias, not quantified in it. Shouldn't 
the type of foo be:

     forall t m a
     .  (Monad m, MonadTransControl t)
     => (Run t -> m a)
     -> t m a


Live well,

More information about the Glasgow-haskell-users mailing list