[Haskell-beginners] how to skip pattern match error when applying a mapM_

Daniel Trstenjak daniel.trstenjak at gmail.com
Tue Jan 17 18:21:38 UTC 2017


> If e.g. 'gamma' is 'Nothing', then the following expressions aren't evaluated
> and the whole "do-block" returns 'Nothing'.

I just saw that 'row' isn't operating in the 'Maybe' monad but in the 'IO' monad,
so this wont work.

I don't know if 'row' contains any side effects that should also be
executed if the returned 'Maybe' is 'Nothing', if this isn't the case,
then you might be able to switch the return type of 'row' from
'IO (Maybe ...)' to 'Maybe (IO ...)' and then you could get the
described behaviour for 'Maybe'.

Greetings,
Daniel


More information about the Beginners mailing list