I don't know if there is generally, but some people would use the lens library to do such things.

import Control.Lens
> sumOf (each . _Just) (Just 1, Nothing, Just 2)
3

Just keep in mind that each member of the tuple must be the same type.

On Tue, Nov 1, 2016 at 11:42 AM, Lai Boon Hui <laiboonh@gmail.com> wrote:
Hi all,

Is it possible to sum a tuple of monoids for example

sum (Just 1, Nothing)

expected result Just 1

sum (Just 1, Just 2)

expected result Just 3

--
Best Regards,
Boon Hui

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners