
Hi, To cut a long story short, could someone explain why:
:t negate negate :: forall a. (Num a) => a -> a
:t let f (fn :: forall a . Num a => a -> a) r s = (fn r, fn s) in f negate let f (fn :: forall a . Num a => a -> a) r s = (fn r, fn s) in f negate :: forall r s. (Num r, Num s) => r -> s -> (r, s)
but
:t let f r s = (return negate) >>= (\fn -> return (fn r, fn s)) in f let f r s = (return negate) >>= (\fn -> return (fn r, fn s)) in f :: forall a (m :: * -> *). (Num a, Monad m) => a -> a -> m (a, a)
and
:t let f r s = (return negate) >>= (\(fn::forall n . (Num n) => n -> n) -> return (fn r, fn s)) in f
<interactive>:1:35: Couldn't match expected type `a -> a' against inferred type `forall n. (Num n) => n -> n' In the pattern: fn :: forall n. (Num n) => n -> n In a lambda abstraction: \ (fn :: forall n. (Num n) => n -> n) -> return (fn r, fn s) In the second argument of `(>>=)', namely `(\ (fn :: forall n. (Num n) => n -> n) -> return (fn r, fn s))' I.e. why does the polymorphism get destroyed? Cheers, Matthew -- Matthew Sackman http://www.wellquite.org/