Re: [Haskell-cafe] unification would give infinite type

2007-12-05 Thread Emil Axelsson
You usually don't need to worry about it. Just keep in mind that if you happen to get a strange type error concerning an (overloaded) function *without type signature*, it sometimes helps to add a signature. / Emil On 2007-12-04 15:52, Rafael wrote: I don't know about monomorphis

[Haskell-cafe] unification would give infinite type

2007-12-04 Thread Rafael
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

Re: [Haskell-cafe] unification would give infinite type

2007-12-04 Thread Emil Axelsson
Hi, Depending on what you want, you should either remove 'return' or change to 'foldM' (from Control.Monad). If you choose the latter, you also need to add a type signature to f (because of the monomorphism restriction). / Emil On 2007-12-04 14:43, Rafael wrote: Hi... I give this error

Re: [Haskell-cafe] unification would give infinite type

2007-12-04 Thread Mattias Bengtsson
Rafael skrev: 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

Re: [Haskell-cafe] unification would give infinite type

2007-12-04 Thread Rafael
Hi Emil, I'm beginning in monad area... I don't know about monomorphis restriction, but foldM works, a lot of thanks... Matias tnks too, i'm conscious about return in the monadic chain. thnks. On Dec 4, 2007 12:00 PM, Emil Axelsson [EMAIL PROTECTED] wrote: Hi, Depending on what you