reducers-3.12.2: Semigroups, specialized containers and a general map/reduce framework

Safe HaskellTrustworthy
LanguageHaskell98

Data.Semigroup.Union

Contents

Synopsis

Documentation

Unions of Containers

class HasUnion f where Source #

A Container suitable for the Union Monoid

Minimal complete definition

union

Methods

union :: f -> f -> f Source #

Instances

HasUnion IntSet Source # 

Methods

union :: IntSet -> IntSet -> IntSet Source #

Eq a => HasUnion [a] Source # 

Methods

union :: [a] -> [a] -> [a] Source #

HasUnion (IntMap a) Source # 

Methods

union :: IntMap a -> IntMap a -> IntMap a Source #

Ord a => HasUnion (Set a) Source # 

Methods

union :: Set a -> Set a -> Set a Source #

(Eq a, Hashable a) => HasUnion (HashSet a) Source # 

Methods

union :: HashSet a -> HashSet a -> HashSet a Source #

Ord k => HasUnion (Map k a) Source # 

Methods

union :: Map k a -> Map k a -> Map k a Source #

(Eq k, Hashable k) => HasUnion (HashMap k a) Source # 

Methods

union :: HashMap k a -> HashMap k a -> HashMap k a Source #

class HasUnion f => HasUnion0 f where Source #

Minimal complete definition

empty

Methods

empty :: f Source #

Instances

HasUnion0 IntSet Source # 

Methods

empty :: IntSet Source #

Eq a => HasUnion0 [a] Source # 

Methods

empty :: [a] Source #

HasUnion0 (IntMap a) Source # 

Methods

empty :: IntMap a Source #

Ord a => HasUnion0 (Set a) Source # 

Methods

empty :: Set a Source #

(Eq a, Hashable a) => HasUnion0 (HashSet a) Source # 

Methods

empty :: HashSet a Source #

Ord k => HasUnion0 (Map k a) Source # 

Methods

empty :: Map k a Source #

(Eq k, Hashable k) => HasUnion0 (HashMap k a) Source # 

Methods

empty :: HashMap k a Source #

newtype Union f Source #

Constructors

Union 

Fields

Instances

Functor Union Source # 

Methods

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

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

Foldable Union Source # 

Methods

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

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

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

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

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

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

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

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

toList :: Union a -> [a] #

null :: Union a -> Bool #

length :: Union a -> Int #

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

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

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

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

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

Traversable Union Source # 

Methods

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

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

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

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

Traversable1 Union Source # 

Methods

traverse1 :: Apply f => (a -> f b) -> Union a -> f (Union b) #

sequence1 :: Apply f => Union (f b) -> f (Union b) #

Foldable1 Union Source # 

Methods

fold1 :: Semigroup m => Union m -> m #

foldMap1 :: Semigroup m => (a -> m) -> Union a -> m #

toNonEmpty :: Union a -> NonEmpty a #

HasUnion f => Reducer f (Union f) Source # 

Methods

unit :: f -> Union f Source #

snoc :: Union f -> f -> Union f Source #

cons :: f -> Union f -> Union f Source #

Eq f => Eq (Union f) Source # 

Methods

(==) :: Union f -> Union f -> Bool #

(/=) :: Union f -> Union f -> Bool #

Ord f => Ord (Union f) Source # 

Methods

compare :: Union f -> Union f -> Ordering #

(<) :: Union f -> Union f -> Bool #

(<=) :: Union f -> Union f -> Bool #

(>) :: Union f -> Union f -> Bool #

(>=) :: Union f -> Union f -> Bool #

max :: Union f -> Union f -> Union f #

min :: Union f -> Union f -> Union f #

Read f => Read (Union f) Source # 
Show f => Show (Union f) Source # 

Methods

showsPrec :: Int -> Union f -> ShowS #

show :: Union f -> String #

showList :: [Union f] -> ShowS #

HasUnion f => Semigroup (Union f) Source # 

Methods

(<>) :: Union f -> Union f -> Union f #

sconcat :: NonEmpty (Union f) -> Union f #

stimes :: Integral b => b -> Union f -> Union f #

HasUnion0 f => Monoid (Union f) Source # 

Methods

mempty :: Union f #

mappend :: Union f -> Union f -> Union f #

mconcat :: [Union f] -> Union f #

Unions of Containers of Semigroups

class Functor f => HasUnionWith f where Source #

Polymorphic containers that we can supply an operation to handle unions with

Minimal complete definition

unionWith

Methods

unionWith :: (a -> a -> a) -> f a -> f a -> f a Source #

Instances

HasUnionWith IntMap Source # 

Methods

unionWith :: (a -> a -> a) -> IntMap a -> IntMap a -> IntMap a Source #

Ord k => HasUnionWith (Map k) Source # 

Methods

unionWith :: (a -> a -> a) -> Map k a -> Map k a -> Map k a Source #

(Eq k, Hashable k) => HasUnionWith (HashMap k) Source # 

Methods

unionWith :: (a -> a -> a) -> HashMap k a -> HashMap k a -> HashMap k a Source #

class HasUnionWith f => HasUnionWith0 f where Source #

Minimal complete definition

emptyWith

Methods

emptyWith :: f a Source #

Instances

newtype UnionWith f m Source #

The Monoid ('unionWith mappend',empty) for containers full of monoids.

Constructors

UnionWith 

Fields

Instances

(HasUnionWith f, Semigroup m, Monoid m) => Reducer (f m) (UnionWith f m) Source # 

Methods

unit :: f m -> UnionWith f m Source #

snoc :: UnionWith f m -> f m -> UnionWith f m Source #

cons :: f m -> UnionWith f m -> UnionWith f m Source #

(HasUnionWith f, Semigroup m) => Semigroup (UnionWith f m) Source # 

Methods

(<>) :: UnionWith f m -> UnionWith f m -> UnionWith f m #

sconcat :: NonEmpty (UnionWith f m) -> UnionWith f m #

stimes :: Integral b => b -> UnionWith f m -> UnionWith f m #

(HasUnionWith0 f, Monoid m) => Monoid (UnionWith f m) Source # 

Methods

mempty :: UnionWith f m #

mappend :: UnionWith f m -> UnionWith f m -> UnionWith f m #

mconcat :: [UnionWith f m] -> UnionWith f m #