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

Copyright(c) 2012-2015 diagrams-core team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellSafe
LanguageHaskell2010

Data.Monoid.Recommend

Description

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 "commitment" (to certainly be used, overriding merely recommended values), along with corresponding Semigroup and Monoid instances.

Synopsis

Documentation

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.

Constructors

Recommend a 
Commit a 
Instances
Functor Recommend Source # 
Instance details

Defined in Data.Monoid.Recommend

Methods

fmap :: (a -> b) -> Recommend a -> Recommend b #

(<$) :: a -> Recommend b -> Recommend a #

Foldable Recommend Source # 
Instance details

Defined in Data.Monoid.Recommend

Methods

fold :: Monoid m => Recommend m -> m #

foldMap :: Monoid m => (a -> m) -> Recommend a -> m #

foldr :: (a -> b -> b) -> b -> Recommend a -> b #

foldr' :: (a -> b -> b) -> b -> Recommend a -> b #

foldl :: (b -> a -> b) -> b -> Recommend a -> b #

foldl' :: (b -> a -> b) -> b -> Recommend a -> b #

foldr1 :: (a -> a -> a) -> Recommend a -> a #

foldl1 :: (a -> a -> a) -> Recommend a -> a #

toList :: Recommend a -> [a] #

null :: Recommend a -> Bool #

length :: Recommend a -> Int #

elem :: Eq a => a -> Recommend a -> Bool #

maximum :: Ord a => Recommend a -> a #

minimum :: Ord a => Recommend a -> a #

sum :: Num a => Recommend a -> a #

product :: Num a => Recommend a -> a #

Traversable Recommend Source # 
Instance details

Defined in Data.Monoid.Recommend

Methods

traverse :: Applicative f => (a -> f b) -> Recommend a -> f (Recommend b) #

sequenceA :: Applicative f => Recommend (f a) -> f (Recommend a) #

mapM :: Monad m => (a -> m b) -> Recommend a -> m (Recommend b) #

sequence :: Monad m => Recommend (m a) -> m (Recommend a) #

Eq a => Eq (Recommend a) Source # 
Instance details

Defined in Data.Monoid.Recommend

Methods

(==) :: Recommend a -> Recommend a -> Bool #

(/=) :: Recommend a -> Recommend a -> Bool #

Data a => Data (Recommend a) Source # 
Instance details

Defined in Data.Monoid.Recommend

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Recommend a -> c (Recommend a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Recommend a) #

toConstr :: Recommend a -> Constr #

dataTypeOf :: Recommend a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Recommend a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Recommend a)) #

gmapT :: (forall b. Data b => b -> b) -> Recommend a -> Recommend a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Recommend a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Recommend a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Recommend a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Recommend a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Recommend a -> m (Recommend a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Recommend a -> m (Recommend a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Recommend a -> m (Recommend a) #

Ord a => Ord (Recommend a) Source # 
Instance details

Defined in Data.Monoid.Recommend

Read a => Read (Recommend a) Source # 
Instance details

Defined in Data.Monoid.Recommend

Show a => Show (Recommend a) Source # 
Instance details

Defined in Data.Monoid.Recommend

Semigroup a => Semigroup (Recommend a) Source #

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

Instance details

Defined in Data.Monoid.Recommend

Methods

(<>) :: Recommend a -> Recommend a -> Recommend a #

sconcat :: NonEmpty (Recommend a) -> Recommend a #

stimes :: Integral b => b -> Recommend a -> Recommend a #

(Semigroup a, Monoid a) => Monoid (Recommend a) Source # 
Instance details

Defined in Data.Monoid.Recommend

getRecommend :: Recommend a -> a Source #

Extract the value of type a wrapped in Recommend a.