monoid-extras- Various extra monoid-related definitions and utilities

Copyright(c) 2012-2015 diagrams-core team (see LICENSE)
LicenseBSD-style (see LICENSE)
Safe HaskellSafe-Inferred



A type for representing values with an additional bit saying whether the value is "just a recommendation" (to be used only if nothing better comes along) or a "committment" (to certainly be used, overriding merely recommended values), along with corresponding Semigroup and Monoid instances.



data Recommend a Source

A value of type Recommend a consists of a value of type a wrapped up in one of two constructors. The Recommend constructor indicates a "non-committal recommendation"---that is, the given value should be used if no other/better values are available. The Commit constructor indicates a "commitment"---a value which should definitely be used, overriding any Recommended values.


Recommend a 
Commit a 


Functor Recommend 
Foldable Recommend 
Traversable Recommend 
Eq a => Eq (Recommend a) 
Data a => Data (Recommend a) 
Ord a => Ord (Recommend a) 
Read a => Read (Recommend a) 
Show a => Show (Recommend a) 
(Semigroup a, Monoid a) => Monoid (Recommend a) 
Semigroup a => Semigroup (Recommend a)

Commit overrides Recommend. Two values wrapped in the same constructor (both Recommend or both Commit) are combined according to the underlying Semigroup instance.

Typeable (* -> *) Recommend 

getRecommend :: Recommend a -> a Source

Extract the value of type a wrapped in Recommend a.