Hello,
Given this program:
------------------------------------------------------------
{-# LANGUAGE Rank2Types #-}
newtype Region s a = Region a
unRegion :: forall a s. Region s a -> a
unRegion (Region x) = x
runRegionPointfull :: forall a. (forall s. Region s a) -> a
runRegionPointfull r = unRegion r
------------------------------------------------------------
Is it possible to write the rank-2 typed function 'runRegionPointfull'
in pointfree style?
Unfortunately the following doesn't typecheck:
runRegionPointfree :: forall a. (forall s. Region s a) -> a
runRegionPointfree = unRegion
Couldn't match expected type `forall s. Region s a'
against inferred type `Region s a1'
In the expression: unRegion
In the definition of `runRegionPointfree':
runRegionPointfree = unRegion
Why can't the typechecker match `forall s. Region s a' and `Region s a1'?
Thanks,
Bas
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe