| > data F = MkF t -> t -- did I get the syntax right?
| Almost
| data F = MkF (t -> t)
| >
| > foo :: (Int, String, F) -> (Int, String)
| > foo (i, s, MkF f) = (f i, f s)
|
| In fact, this extension has been implemented in Hugs
| and ghc as well as I understand it, but neither of these
| implementations have been made publically available.
Actually it still isn't in GHC, but it Will Be. I'm planning to do a bit
more, in fact, and allow:
foo :: (forall t. t->t) -> (Int, String) -> (Int,String)
foo f (a,b) = (f a, f b)
So I plan to permit universal quantification at the top level
of a function argument. The main motivation is to allow us to
write user versions of runST, such as
myRunST :: Int -> (forall s. ST s Int) -> Int
myRunST n st = n + runST st
At present, only "runST" itself has the magic type required.
Implementing this is no more difficult than doing it for constructors.
Of course, a type signature is *required*. All inferred types will be
as now.
It won't happen overnight though. Still trying to get 2.02 out of the door!
Simon