In the code below, is the type returned by the return functions inferred from
the result type in the function type signature, i.e., just change the result
type to Maybe Int and the code will return a Maybe monad, (Just 4), instead of
a List monad?
Michael
=========
import Monad
fn :: [Int] -> [Int]
fn l = mzero `mplus` (return (head l)) `mplus` (return (last l))
================
*Main> :l test5
[1 of 1] Compiling Main ( test5.hs, interpreted )
Ok, modules loaded: Main.
*Main> fn [4,5,6,7,8]
[4,8]
*Main>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe