[Haskell-cafe] Funny State monad dependency
haberg at math.su.se
Wed Apr 16 08:56:33 EDT 2008
When I load the State module in Hugs, then I can define the function
f below, but I do not immediately see exactly what function "return"
returns. Explanation welcome.
> f [2..4] [6..9]
That is, it just repeats the second argument as many times as the
length of the second argument.
f :: Monad a => a b -> a c -> a c
f x y = x >>= (return y)
More information about the Haskell-Cafe