Data.Semigroup.Union

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

Safe Haskell | Trustworthy
Language | Haskell98

Data.Semigroup.Union

Contents

- Unions of Containers
- Unions of Containers of Semigroups

Synopsis

- module Data.Semigroup.Reducer
- class HasUnion f where
- class HasUnion f => HasUnion0 f where
- newtype Union f = Union {
  - getUnion :: f
  }
- class Functor f => HasUnionWith f where
- class HasUnionWith f => HasUnionWith0 f where
- newtype UnionWith f m = UnionWith {
  - getUnionWith :: f m
  }

# Documentation

module Data.Semigroup.Reducer

# Unions of Containers

class HasUnion f where #

A Container suitable for the `Union` `Monoid`

Minimal complete definition

union

Methods

union :: f -> f -> f #

Instances

HasUnion IntSet # |
Methods union :: IntSet -> IntSet -> IntSet #
Eq a => HasUnion [a] # |
Methods union :: [a] -> [a] -> [a] #
HasUnion (IntMap a) # |
Methods union :: IntMap a -> IntMap a -> IntMap a #
Ord a => HasUnion (Set a) # |
Methods union :: Set a -> Set a -> Set a #
(Eq a, Hashable a) => HasUnion (HashSet a) # |
Methods union :: HashSet a -> HashSet a -> HashSet a #
Ord k => HasUnion (Map k a) # |
Methods union :: Map k a -> Map k a -> Map k a #
(Eq k, Hashable k) => HasUnion (HashMap k a) # |
Methods union :: HashMap k a -> HashMap k a -> HashMap k a #

class HasUnion f => HasUnion0 f where #

Minimal complete definition

empty

Methods

empty :: f #

Instances

HasUnion0 IntSet # |
Methods empty :: IntSet #
Eq a => HasUnion0 [a] # |
Methods empty :: [a] #
HasUnion0 (IntMap a) # |
Methods empty :: IntMap a #
Ord a => HasUnion0 (Set a) # |
Methods empty :: Set a #
(Eq a, Hashable a) => HasUnion0 (HashSet a) # |
Methods empty :: HashSet a #
Ord k => HasUnion0 (Map k a) # |
Methods empty :: Map k a #
(Eq k, Hashable k) => HasUnion0 (HashMap k a) # |
Methods empty :: HashMap k a #

newtype Union f #

The `Monoid` `(`union`,`empty`)`

Constructors

Union |
Fields getUnion :: f

Instances

Functor Union # |
Methods fmap :: (a -> b) -> Union a -> Union b # (<$) :: a -> Union b -> Union a #
Foldable Union # |
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 # |
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 # |
Methods traverse1 :: Apply f => (a -> f b) -> Union a -> f (Union b) # sequence1 :: Apply f => Union (f b) -> f (Union b) #
Foldable1 Union # |
Methods fold1 :: Semigroup m => Union m -> m # foldMap1 :: Semigroup m => (a -> m) -> Union a -> m #
HasUnion f => Reducer f (Union f) # |
Methods unit :: f -> Union f # snoc :: Union f -> f -> Union f # cons :: f -> Union f -> Union f #
Eq f => Eq (Union f) # |
Methods (==) :: Union f -> Union f -> Bool # (/=) :: Union f -> Union f -> Bool #
Ord f => Ord (Union f) # |
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) # |
Methods readsPrec :: Int -> ReadS (Union f) # readList :: ReadS [Union f] # readPrec :: ReadPrec (Union f) # readListPrec :: ReadPrec [Union f] #
Show f => Show (Union f) # |
Methods showsPrec :: Int -> Union f -> ShowS # show :: Union f -> String # showList :: [Union f] -> ShowS #
HasUnion f => Semigroup (Union f) # |
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) # |
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 #

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 #

Instances

HasUnionWith IntMap # |
Methods unionWith :: (a -> a -> a) -> IntMap a -> IntMap a -> IntMap a #
Ord k => HasUnionWith (Map k) # |
Methods unionWith :: (a -> a -> a) -> Map k a -> Map k a -> Map k a #

class HasUnionWith f => HasUnionWith0 f where #

Minimal complete definition

emptyWith

Methods

emptyWith :: f a #

Instances

HasUnionWith0 IntMap # |
Methods emptyWith :: IntMap a #
Ord k => HasUnionWith0 (Map k) # |
Methods emptyWith :: Map k a #

newtype UnionWith f m #

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

Constructors

UnionWith |
Fields getUnionWith :: f m

Instances

(HasUnionWith f, Semigroup m, Monoid m) => Reducer (f m) (UnionWith f m) # |
Methods unit :: f m -> UnionWith f m # snoc :: UnionWith f m -> f m -> UnionWith f m # cons :: f m -> UnionWith f m -> UnionWith f m #
(HasUnionWith f, Semigroup m) => Semigroup (UnionWith f m) # |
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) # |
Methods mempty :: UnionWith f m # mappend :: UnionWith f m -> UnionWith f m -> UnionWith f m # mconcat :: [UnionWith f m] -> UnionWith f m #