Why is Haskell complaining when trying to parse this type signature?
f :: (a,s) -> (forall r.(r -> (a,r)),s)
Haskell does not support impredicative types, and in particular does not allow forall
to appear under any type constructor (except ->
).
For example, Maybe (forall a. a), [forall a. a->a], ((forall a. a), Bool)
are forbidden.
Use a newtype
wrapper if that's what you want.
newtype T = T (forall a. a->a)
foo :: [T] -- OK
foo = [T id]