|
|
Dear Group,
When I fire up ghci and define:
increment x = return (x+1)
I can say:
Main> increment 1
and ghci dutifully replies 2. Also as expected, the type signature of
increment is: (Num a, Monad m) => a -> m a
However, if I say:
Main> let a = increment 1
I get:
<interactive>:1:8:
Ambiguous type variable `m' in the constraint:
`Monad m' arising from a use of `increment' at <interactive>:1:8-18
Probable fix: add a type signature that fixes these type variable(s)
Have I, like Monsier Jourdain, been running in the IO monad all my
life, and didn't even know it?
Thanks,
Henry Laxen
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/haskell-cafe
|
|