
Because applying f to the list is not the same thing is applying bind to the list and f. Bob On 26 Feb 2011, at 20:17, michael rice wrote:
Why? Shouldn't this work for any type a?
Michael
==========
f :: [a] -> [a] f l = do x <- l return x
==========
*Main> :r [1 of 1] Compiling Main ( test.hs, interpreted ) Ok, modules loaded: Main. *Main> f "abcde" "abcde" *Main> f [1,2,3,4,5] [1,2,3,4,5] *Main> "abcde" >>= f
<interactive>:1:12: Couldn't match expected type `Char' against inferred type `m b' In the second argument of `(>>=)', namely `f' In the expression: "abcde" >>= f In the definition of `it': it = "abcde" >>= f *Main>
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe