I wrote:

> ... the Haskell report says that there is no way to declare an
> explicitly universally quantified type.  My question is simple: why not?

I apologize: it is bad form to ask the same question twice, I know,
but I'm afraid my memory is failing -- I must be getting old ;-).
I forgot that we already had a discussion about this topic on this list
only a few months ago, and that discussion basically answered my question.

The answer, for anyone else who is interested, was that if you allow
nested quantifiers everywhere, then type-checking must solve
higher-order unification, which is in general undecidable.  You can
allow quantifiers at the top level of data structures, though, and
according to Lennart Augustsson hbc allows that; so in hbc my example
could be rewritten as something like this:

        data F = MkF t -> t     -- did I get the syntax right?

        foo :: (Int, String, F) -> (Int, String)
        foo (i, s, MkF f) = (f i, f s)

-- 
Fergus Henderson <[EMAIL PROTECTED]>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]         |     -- the last words of T. S. Garp.



Reply via email to