> > 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.
I imagine that this conflicts somewhat with Laufer and Odersky's
proposal to assume that free type variables in data declarations
should be *existentially* quantified, leading to first-class
abstract types.
@Article{laufer-jfp96,
author = "L{\"{a}}ufer, K.",
title = "Type Classes with Existential Types",
journal = "Journal of Functional Programming",
year = 1996,
month = may,
volume = 6,
number = 3,
pages = "485--517",
URL = "ftp://ftp.math.luc.edu/pub/laufer/papers/haskell+extypes.ps.gz"
}
....................................................................
Ian Stark http://www.brics.dk/~stark
BRICS, Department of Computer Science, University of Aarhus, Denmark