Because GHC does not allow you to instantiate a polymorphic type
variable with a polymorphic type. For example, you can have
Maybe Int
Maybe (Int - Int)
but not
Maybe (forall a. a-a)
The Maybe type is defined thus
data Maybe b = Nothing | Just b
so the type
Hi!
On Thu, Jan 23, 2003 at 10:28:13AM -, Simon Peyton-Jones wrote:
To get around it, define your own data type:
data MyPr = MyPr (forall a.a-a) (forall a.a-a)
swap1 :: MyPr - MyPr
I played a bit with using highed order polymorphism for this problem,
and have encountered
| The first version doesn't compile - the error is:
| Type synonym `F3' should have 1 argument, but has been given 0
| In the type: Pair F3 F2
| While checking the type signature for `p'
Type synonyms in Haskell must be saturated (i.e. given all their
argments).
GHC lifts this restriction