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

Safe Haskell | Trustworthy
Language | Haskell2010

Data.Semigroup.Union

Contents

- Unions of Containers
- Unions of Containers of Semigroups

Synopsis

- module Data.Semigroup.Reducer
- class HasUnion f where
  - union :: f -> f -> f
- class HasUnion f => HasUnion0 f where
  - empty :: f
- newtype Union f = Union {
  - getUnion :: f
  }
- class Functor f => HasUnionWith f where
  - unionWith :: (a -> a -> a) -> f a -> f a -> f a
- class HasUnionWith f => HasUnionWith0 f where
  - emptyWith :: f a
- newtype UnionWith f m = UnionWith {
  - getUnionWith :: f m
  }

# Documentation

module Data.Semigroup.Reducer

# Unions of Containers

class HasUnion f where Source #

A Container suitable for the `Union` `Monoid`

Methods

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

#### Instances

Instances details

HasUnion IntSet Source # |
Instance details Defined in Data.Semigroup.Union Methods union :: IntSet -> IntSet -> IntSet Source #
HasUnion (IntMap a) Source # |
Instance details Defined in Data.Semigroup.Union Methods union :: IntMap a -> IntMap a -> IntMap a Source #
Ord a => HasUnion (Set a) Source # |
Instance details Defined in Data.Semigroup.Union Methods union :: Set a -> Set a -> Set a Source #
(Eq a, Hashable a) => HasUnion (HashSet a) Source # |
Instance details Defined in Data.Semigroup.Union Methods union :: HashSet a -> HashSet a -> HashSet a Source #
Eq a => HasUnion [a] Source # |
Instance details Defined in Data.Semigroup.Union Methods union :: [a] -> [a] -> [a] Source #
Ord k => HasUnion (Map k a) Source # |
Instance details Defined in Data.Semigroup.Union Methods union :: Map k a -> Map k a -> Map k a Source #
(Eq k, Hashable k) => HasUnion (HashMap k a) Source # |
Instance details Defined in Data.Semigroup.Union Methods union :: HashMap k a -> HashMap k a -> HashMap k a Source #

class HasUnion f => HasUnion0 f where Source #

Methods

empty :: f Source #

#### Instances

Instances details

HasUnion0 IntSet Source # |
Instance details Defined in Data.Semigroup.Union Methods empty :: IntSet Source #
HasUnion0 (IntMap a) Source # |
Instance details Defined in Data.Semigroup.Union Methods empty :: IntMap a Source #
Ord a => HasUnion0 (Set a) Source # |
Instance details Defined in Data.Semigroup.Union Methods empty :: Set a Source #
(Eq a, Hashable a) => HasUnion0 (HashSet a) Source # |
Instance details Defined in Data.Semigroup.Union Methods empty :: HashSet a Source #
Eq a => HasUnion0 [a] Source # |
Instance details Defined in Data.Semigroup.Union Methods empty :: [a] Source #
Ord k => HasUnion0 (Map k a) Source # |
Instance details Defined in Data.Semigroup.Union Methods empty :: Map k a Source #
(Eq k, Hashable k) => HasUnion0 (HashMap k a) Source # |
Instance details Defined in Data.Semigroup.Union Methods empty :: HashMap k a Source #

newtype Union f Source #

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

Constructors

Union |

Fields

- getUnion :: f

#### Instances

Instances details

Foldable Union Source # |

Instance details

Defined in Data.Semigroup.Union

Methods

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

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

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

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

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

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

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

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

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

toList :: Union a -> [a] Source #

null :: Union a -> Bool Source #

length :: Union a -> Int Source #

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

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

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

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

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

Foldable1 Union Source # |

Instance details

Defined in Data.Semigroup.Union

Methods

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

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

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

toNonEmpty :: Union a -> NonEmpty a Source #

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

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

head :: Union a -> a Source #

last :: Union a -> a Source #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> Union a -> b Source #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Union a -> b Source #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> Union a -> b Source #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Union a -> b Source #

Traversable Union Source # |
Instance details Defined in Data.Semigroup.Union Methods traverse :: Applicative f => (a -> f b) -> Union a -> f (Union b) Source # sequenceA :: Applicative f => Union (f a) -> f (Union a) Source # mapM :: Monad m => (a -> m b) -> Union a -> m (Union b) Source # sequence :: Monad m => Union (m a) -> m (Union a) Source #
Functor Union Source # |
Instance details Defined in Data.Semigroup.Union Methods fmap :: (a -> b) -> Union a -> Union b Source # (<$) :: a -> Union b -> Union a Source #
Traversable1 Union Source # |
Instance details Defined in Data.Semigroup.Union Methods traverse1 :: Apply f => (a -> f b) -> Union a -> f (Union b) Source # sequence1 :: Apply f => Union (f b) -> f (Union b) Source #
HasUnion f => Reducer f (Union f) Source # |
Instance details Defined in Data.Semigroup.Union Methods unit :: f -> Union f Source # snoc :: Union f -> f -> Union f Source # cons :: f -> Union f -> Union f Source #
HasUnion0 f => Monoid (Union f) Source # |
Instance details Defined in Data.Semigroup.Union Methods mempty :: Union f Source # mappend :: Union f -> Union f -> Union f Source # mconcat :: [Union f] -> Union f Source #
HasUnion f => Semigroup (Union f) Source # |
Instance details Defined in Data.Semigroup.Union Methods (<>) :: Union f -> Union f -> Union f Source # sconcat :: NonEmpty (Union f) -> Union f Source # stimes :: Integral b => b -> Union f -> Union f Source #
Read f => Read (Union f) Source # |
Instance details Defined in Data.Semigroup.Union Methods readsPrec :: Int -> ReadS (Union f) Source # readList :: ReadS [Union f] Source # readPrec :: ReadPrec (Union f) Source # readListPrec :: ReadPrec [Union f] Source #
Show f => Show (Union f) Source # |
Instance details Defined in Data.Semigroup.Union Methods showsPrec :: Int -> Union f -> ShowS Source # show :: Union f -> String Source # showList :: [Union f] -> ShowS Source #
Eq f => Eq (Union f) Source # |
Instance details Defined in Data.Semigroup.Union Methods (==) :: Union f -> Union f -> Bool Source # (/=) :: Union f -> Union f -> Bool Source #
Ord f => Ord (Union f) Source # |
Instance details Defined in Data.Semigroup.Union Methods compare :: Union f -> Union f -> Ordering Source # (<) :: Union f -> Union f -> Bool Source # (<=) :: Union f -> Union f -> Bool Source # (>) :: Union f -> Union f -> Bool Source # (>=) :: Union f -> Union f -> Bool Source # max :: Union f -> Union f -> Union f Source # min :: Union f -> Union f -> Union f Source #

# Unions of Containers of Semigroups

class Functor f => HasUnionWith f where Source #

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

Methods

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

#### Instances

Instances details

HasUnionWith IntMap Source # |
Instance details Defined in Data.Semigroup.Union Methods unionWith :: (a -> a -> a) -> IntMap a -> IntMap a -> IntMap a Source #
Ord k => HasUnionWith (Map k) Source # |
Instance details Defined in Data.Semigroup.Union Methods unionWith :: (a -> a -> a) -> Map k a -> Map k a -> Map k a Source #
(Eq k, Hashable k) => HasUnionWith (HashMap k) Source # |
Instance details Defined in Data.Semigroup.Union Methods unionWith :: (a -> a -> a) -> HashMap k a -> HashMap k a -> HashMap k a Source #

class HasUnionWith f => HasUnionWith0 f where Source #

Methods

emptyWith :: f a Source #

#### Instances

Instances details

HasUnionWith0 IntMap Source # |
Instance details Defined in Data.Semigroup.Union Methods emptyWith :: IntMap a Source #
Ord k => HasUnionWith0 (Map k) Source # |
Instance details Defined in Data.Semigroup.Union Methods emptyWith :: Map k a Source #
(Eq k, Hashable k) => HasUnionWith0 (HashMap k) Source # |
Instance details Defined in Data.Semigroup.Union Methods emptyWith :: HashMap k a Source #

newtype UnionWith f m Source #

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

Constructors

UnionWith |

Fields

- getUnionWith :: f m

#### Instances

Instances details

(HasUnionWith f, Semigroup m, Monoid m) => Reducer (f m) (UnionWith f m) Source # |
Instance details Defined in Data.Semigroup.Union 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 #
(HasUnionWith0 f, Monoid m) => Monoid (UnionWith f m) Source # |
Instance details Defined in Data.Semigroup.Union Methods mempty :: UnionWith f m Source # mappend :: UnionWith f m -> UnionWith f m -> UnionWith f m Source # mconcat :: [UnionWith f m] -> UnionWith f m Source #
(HasUnionWith f, Semigroup m) => Semigroup (UnionWith f m) Source # |
Instance details Defined in Data.Semigroup.Union Methods (<>) :: UnionWith f m -> UnionWith f m -> UnionWith f m Source # sconcat :: NonEmpty (UnionWith f m) -> UnionWith f m Source # stimes :: Integral b => b -> UnionWith f m -> UnionWith f m Source #