[Haskell-cafe] unification would give infinite type

Rafael verganic at gmail.com
Tue Dec 4 08:43:44 EST 2007

Hi... I give this error using hugs for the code:

f = foldl (\x y -> add x y) 0 [1,2,3]
add x y = return (x + y)
I try:

f = foldl (\x y -> counter x y) (return 0) [1,2,3]

but it dont solve,  and with ghci:

    Occurs check: cannot construct the infinite type: b = m b
      Expected type: b
      Inferred type: m b
    In the expression: add x y
    In a lambda abstraction: \ x y -> add x y



More information about the Haskell-Cafe mailing list