Re [Haskell-cafe] Vanishing polymorphism

Matthew Sackman matthew at wellquite.org
Tue May 8 17:58:36 EDT 2007


Sorry, am subscribed with digest and haven't got David House's reply via
email yet, hence the broken thread.

It's not to do with lambdas though:

> :t let f r s = let g (fn::forall n . (Num n) => n -> n) = return (fn r, fn s) in (return negate) >>= g in f

<interactive>:1:98:
    Couldn't match expected type `a -> a'
           against inferred type `forall n. (Num n) => n -> n'
      Expected type: (a -> a) -> m b
      Inferred type: (forall n2. (Num n2) => n2 -> n2) -> m1 (n, n1)
    In the second argument of `(>>=)', namely `g'
    In the expression:
        let g (fn :: forall n. (Num n) => n -> n) = return (fn r, fn s)
        in (return negate) >>= g

...unless we're talking about lambdas in the definitions of return and
>>= which would be quite worrying.

Matthew
-- 
Matthew Sackman
http://www.wellquite.org/


More information about the Haskell-Cafe mailing list