| Copyright | [2016..2017] Trevor L. McDonell |
|---|---|
| License | BSD3 |
| Maintainer | Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> |
| Stability | experimental |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | None |
| Language | Haskell98 |
Data.Array.Accelerate.Data.Monoid
Contents
Description
Monoid instances for Accelerate
Documentation
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws:
mappend mempty x = x
mappend x mempty = x
mappend x (mappend y z) = mappend (mappend x y) z
mconcat =
foldrmappend mempty
The method names refer to the monoid of lists under concatenation, but there are many other instances.
Some types can be viewed as a monoid in more than one way,
e.g. both addition and multiplication on numbers.
In such cases we often define newtypes and make those instances
of Monoid, e.g. Sum and Product.
Methods
Identity of mappend
An associative operation
Fold a list using the monoid.
For most types, the default definition for mconcat will be
used, but the function is included in the class definition so
that an optimized version can be provided for specific types.
Instances
| Monoid Ordering | Since: 2.1 |
| Monoid () | Since: 2.1 |
| Monoid All | Since: 2.1 |
| Monoid Any | Since: 2.1 |
| Monoid ShortByteString | |
| Monoid ByteString | |
| Monoid ByteString | |
| Monoid Builder | |
| Monoid IntSet | |
| Monoid Slot | |
| Monoid Doc | |
| Monoid [a] | Since: 2.1 |
| Monoid a => Monoid (Maybe a) | Lift a semigroup into Since: 2.1 |
| Monoid a => Monoid (IO a) | Since: 4.9.0.0 |
| (Ord a, Bounded a) => Monoid (Min a) | Since: 4.9.0.0 |
| (Ord a, Bounded a) => Monoid (Max a) | Since: 4.9.0.0 |
| Monoid m => Monoid (WrappedMonoid m) | Since: 4.9.0.0 |
| Semigroup a => Monoid (Option a) | Since: 4.9.0.0 |
| Monoid a => Monoid (Identity a) | |
| Monoid a => Monoid (Dual a) | Since: 2.1 |
| Monoid (Endo a) | Since: 2.1 |
| Num a => Monoid (Sum a) | Since: 2.1 |
| Num a => Monoid (Product a) | Since: 2.1 |
| Monoid (First a) | Since: 2.1 |
| Monoid (Last a) | Since: 2.1 |
| Monoid (IntMap a) | |
| Monoid (Seq a) | |
| Ord a => Monoid (Set a) | |
| Monoid (Doc a) | |
| Monoid (Array a) | |
| (Hashable a, Eq a) => Monoid (HashSet a) | |
| Prim a => Monoid (Vector a) | |
| Monoid (Vector a) | |
| Monoid b => Monoid (a -> b) | Since: 2.1 |
| (Monoid a, Monoid b) => Monoid (a, b) | Since: 2.1 |
| Monoid (Proxy k s) | Since: 4.7.0.0 |
| Ord k => Monoid (Map k v) | |
| (Eq k, Hashable k) => Monoid (HashMap k v) | |
| (Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) | Since: 2.1 |
| Monoid a => Monoid (Const k a b) | |
| Alternative f => Monoid (Alt * f a) | Since: 4.8.0.0 |
| (Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) | Since: 2.1 |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) | Since: 2.1 |
Monoid under addition.
Instances
| Monad Sum | Since: 4.8.0.0 |
| Functor Sum | Since: 4.8.0.0 |
| MonadFix Sum | Since: 4.8.0.0 |
| Applicative Sum | Since: 4.8.0.0 |
| Foldable Sum | Since: 4.8.0.0 |
| Traversable Sum | Since: 4.8.0.0 |
| NFData1 Sum | Since: 1.4.3.0 |
| Bounded a => Bounded (Sum a) | |
| Eq a => Eq (Sum a) | |
| Num a => Num (Sum a) | |
| Ord a => Ord (Sum a) | |
| Read a => Read (Sum a) | |
| Show a => Show (Sum a) | |
| Generic (Sum a) | |
| Num a => Semigroup (Sum a) | Since: 4.9.0.0 |
| Num a => Monoid (Sum a) | Since: 2.1 |
| NFData a => NFData (Sum a) | Since: 1.4.0.0 |
| Generic1 * Sum | |
| type Rep (Sum a) | |
| type Plain (Sum a) Source # | |
| type Rep1 * Sum | |
Monoid under multiplication.
Constructors
| Product | |
Fields
| |
Instances
| Monad Product | Since: 4.8.0.0 |
| Functor Product | Since: 4.8.0.0 |
| MonadFix Product | Since: 4.8.0.0 |
| Applicative Product | Since: 4.8.0.0 |
| Foldable Product | Since: 4.8.0.0 |
| Traversable Product | Since: 4.8.0.0 |
| NFData1 Product | Since: 1.4.3.0 |
| Bounded a => Bounded (Product a) | |
| Eq a => Eq (Product a) | |
| Num a => Num (Product a) | |
| Ord a => Ord (Product a) | |
| Read a => Read (Product a) | |
| Show a => Show (Product a) | |
| Generic (Product a) | |
| Num a => Semigroup (Product a) | Since: 4.9.0.0 |
| Num a => Monoid (Product a) | Since: 2.1 |
| NFData a => NFData (Product a) | Since: 1.4.0.0 |
| Generic1 * Product | |
| type Rep (Product a) | |
| type Plain (Product a) Source # | |
| type Rep1 * Product | |