[Haskell-cafe] IO (Either a Error) question

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Sat May 8 01:32:34 EDT 2010


"Brandon S. Allbery KF8NH" <allbery at ece.cmu.edu> writes:

> On May 8, 2010, at 01:16 , Ivan Lazar Miljenovic wrote:
>> Huh?  What about "maybeAdd (Just 2) Nothing" ?
>
> Isn't that handled by the definition of (>>=) in Maybe, as opposed to
> by invoking fail?
>
>> instance Monad Maybe where
>>   -- ...
>>   Nothing >>= _ = Nothing
>>   (Just x) >>= f = f x

Yes, but isn't the "y <- Nothing" pattern failure handled by invoking
fail?

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list