[Haskell-beginners] Maybe monad and computations

divyanshu ranjan idivyanshu.ranjan at gmail.com
Fri Sep 6 22:21:48 CEST 2013


Hi,
  Can you provide little more details or code snippet as It is not
clear what you want to achieve.

Thanks
Divyanshu Ranjan

On Sat, Sep 7, 2013 at 1:19 AM, Emmanuel Touzery <etouzery at gmail.com> wrote:
> Hello,
>
>  I'm often using the Maybe monad to combine Maybe computations one after the
> other without conditionals.
>
>  But I'm not sure how to do it, when I have several operations which return
> Maybe and I want all the indiviual values in the end, not a combination of
> the values.
>
>  Currently I do:
>
> let allTogether = do
>   ma <- doA
>   mb <- doB
>   return (ma, mb)
> case allTogether of
>   Nothing -> ...
>   Just (a, b) -> ...
>
>  This way in this case I have one case instead of two, however I'm sure
> there must be a nicer way to achieve this result?
>
>  Thank you!
>
> Emmanuel
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>




More information about the Beginners mailing list