universum-1.2.0: Custom prelude used in Serokell

Safe HaskellSafe
LanguageHaskell2010

Universum.Monoid

Description

This module reexports functions to work with monoids plus adds extra useful functions.

Synopsis

Documentation

maybeToMonoid :: Monoid m => Maybe m -> m Source #

Extracts Monoid value from Maybe returning mempty if Nothing.

>>> maybeToMonoid (Just [1,2,3] :: Maybe [Int])
[1,2,3]
>>> maybeToMonoid (Nothing :: Maybe [Int])
[]