first-class polymorphism beats rank-2 polymorphism

Simon Peyton-Jones
Mon, 11 Mar 2002 02:46:55 -0800

| Looking at the type of sequ,
| the foralls for t end up at the top.
| Hence, I have no chance to define sequential
| composition.

Indeed the foralls are at the top, but I claim that wherever
you could use the composition function you were expecting,
you can also use the one GHC gives you.  The two types
are isomorphic.

Let me know if you find a situation where this isn't true.

| Please let me know if this is a bug.

No I believe it is not a bug.  I would be interested to see why you
needed to change your code.

| I just realized that type synonyms in GHC seem to be valid=20
| arguments even when not completely instantiated? This is=20
| wonderful. It is not supported in hugs. How difficult is it=20
| to cope with this? Does it make a real difference for the type system?

No, GHC does not support partially applied type synonyms,=20
except in the RHS of other type synonyms.  It is a VERY BIG thing to
allow this, because it amounts  to allowing lambdas at the type level
and that messes up inference cruelly.

Why do you think GHC does?