Hi,

For the following program

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

ghc 0.24 reports

        "foo.hs", line 2:
            Couldn't match the type `Int' against `String'.
            In the first argument of `f',  namely `s',
            Expected type of the argument:  Int
            Inferred type of the argument:  String
            Possible cause of error: `f' is not polymorphic
            it is monomorphic in the type variable(s): o_4

(nice error message, BTW).

It would be nice if you could explicitly declare that `f'
had a polymorphic higher-order type `forall t . t -> t',
e.g. by

> foo :: (Int, String, (forall t . t -> t)) -> (Int, String)

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

-- 
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