Why has the operator (.) troubles with a type like (forall s. ST s a)?
Why can't it match the type 'b' in (.) definition?
On Thursday 10 March 2011 14:18:24, Anakim Border wrote:If memory serves correctly, it's impredicative polymorphism.
> Dear list,
>
> I have the following (simplified) piece of code:
>
> find :: Int -> [Int]
> find i = runST . (`runContT` return) $
> callCC $ \escape -> do
> return []
>
> which used to compile correctly under GHC 6.12.3.
>
> Now that I've switched to 7.0.2 it gets rejected with the following
> error:
>
> Couldn't match expected type `forall s. ST s c0'
> with actual type `m0 r0'
> Expected type: ContT r0 m0 a0 -> forall s. ST s c0
> Actual type: ContT r0 m0 a0 -> m0 r0
> In the second argument of `(.)', namely `(`runContT` return)'
> In the expression: runST . (`runContT` return)
>
>
> I'm a little bit lost at what exactly is the problem.
The type of (.), (b -> c) -> (a -> b) -> a -> c, can't handle
(x -> forall s. ST s [Int])
Previously there was an implementation of impredicative polymorphism which
allowed GHC to handle that construct, but that has been removed (because it
was unsatisfactory), so GHC 7 doesn't compile that anymore.
Parentheses.
> Anyone can suggest a solution?
return [])
find i = runST ((`runContT` return) $
callCC $ \escape -> do
>
> Thanks!
>
> AB
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe