[Haskell-beginners] Sum a tuple of Monoids

Imants Cekusins imantc at gmail.com
Tue Nov 1 15:55:38 UTC 2016


> sum a tuple of monoids

here is something, not quite what you are looking for, but close:

Monoid
<http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Monoid.html#t:Monoid>
a
=> Monoid
<http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Monoid.html#t:Monoid>
 (Maybe
<http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Maybe.html#t:Maybe>
 a)
(Monoid
<http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Monoid.html#t:Monoid>
 a, Monoid
<http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Monoid.html#t:Monoid>
b)
=> Monoid
<http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Monoid.html#t:Monoid>
(a,
b)

mappend (Just [1], Just [2,3]) (Nothing, Just [5])::(Maybe [Int],Maybe
[Int])
(Just [1],Just [2,3,5])

​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20161101/f4ce93e5/attachment.html>


More information about the Beginners mailing list