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?