[Haskell-cafe] Rank2Types and pattern matching

Yves Parès limestrael at gmail.com
Sun Jul 4 05:41:07 EDT 2010


Okay, I understand better, now.
But I could never have guessed it just from the GHC error message.

Another question on the same code:

import Control.Monad.Identity

newtype SomeMonad s a = SomeMonad { unSome :: Identity a }
  deriving (Monad)

newtype SomeType s = SomeType Int

runSomeMonad :: (forall s. SomeMonad s a) -> a
runSomeMonad x = runIdentity . unSome $ x

foo :: SomeType s
foo = runSomeMonad (return $ SomeType 42)


According to what I read about ST, it should not compile because of 'foo'
(hence the protection), well it does.
What have I forgotten in my code?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100704/5da21b88/attachment.html


More information about the Haskell-Cafe mailing list