generic-deriving-1.14.6: Generic programming library for generalised deriving.
Safe HaskellSafe
LanguageHaskell2010

Generics.Deriving.Monoid

Synopsis

Documentation

newtype Any #

Boolean monoid under disjunction (||).

Any x <> Any y = Any (x || y)

Examples

Expand
>>> Any True <> mempty <> Any False
Any {getAny = True}
>>> mconcat (map (\x -> Any (even x)) [2,4,6,7,8])
Any {getAny = True}
>>> Any False <> mempty
Any {getAny = False}

Constructors

Any 

Fields

Instances

Instances details
GEnum Any # 
Instance details

Defined in Generics.Deriving.Enum

Methods

genum :: [Any] #

GIx Any # 
Instance details

Defined in Generics.Deriving.Enum

Methods

range :: (Any, Any) -> [Any] #

index :: (Any, Any) -> Any -> Int #

inRange :: (Any, Any) -> Any -> Bool #

GEq Any # 
Instance details

Defined in Generics.Deriving.Eq

Methods

geq :: Any -> Any -> Bool #

GMonoid Any # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Any #

gmappend :: Any -> Any -> Any #

gmconcat :: [Any] -> Any #

GSemigroup Any # 
Instance details

Defined in Generics.Deriving.Semigroup.Internal

Methods

gsappend :: Any -> Any -> Any #

gstimes :: Integral b => b -> Any -> Any #

gsconcat :: NonEmpty Any -> Any #

GShow Any # 
Instance details

Defined in Generics.Deriving.Show

Methods

gshowsPrec :: Int -> Any -> ShowS #

gshows :: Any -> ShowS #

gshow :: Any -> String #

gshowList :: [Any] -> ShowS #

Monoid Any

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: Any #

mappend :: Any -> Any -> Any #

mconcat :: [Any] -> Any #

Semigroup Any

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

(<>) :: Any -> Any -> Any #

sconcat :: NonEmpty Any -> Any #

stimes :: Integral b => b -> Any -> Any #

Bounded Any

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

minBound :: Any #

maxBound :: Any #

Generic Any 
Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Associated Types

type Rep Any

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep Any = D1 ('MetaData "Any" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Any" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAny") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))

Methods

from :: Any -> Rep Any x #

to :: Rep Any x -> Any #

Read Any

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Show Any

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

showsPrec :: Int -> Any -> ShowS #

show :: Any -> String #

showList :: [Any] -> ShowS #

Eq Any

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

(==) :: Any -> Any -> Bool #

(/=) :: Any -> Any -> Bool #

Ord Any

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

compare :: Any -> Any -> Ordering #

(<) :: Any -> Any -> Bool #

(<=) :: Any -> Any -> Bool #

(>) :: Any -> Any -> Bool #

(>=) :: Any -> Any -> Bool #

max :: Any -> Any -> Any #

min :: Any -> Any -> Any #

type Rep Any

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep Any = D1 ('MetaData "Any" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Any" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAny") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))

newtype Last a #

Maybe monoid returning the rightmost non-Nothing value.

Last a is isomorphic to Dual (First a), and thus to Dual (Alt Maybe a)

Data.Semigroup.Last. The former returns the last non-Nothing, so x <> Data.Monoid.Last Nothing = x. The latter simply returns the last value, thus x <> Data.Semigroup.Last Nothing = Data.Semigroup.Last Nothing.

Examples

Expand
>>> Last (Just "hello") <> Last Nothing <> Last (Just "world")
Last {getLast = Just "world"}
>>> Last Nothing <> mempty
Last {getLast = Nothing}

Constructors

Last 

Fields

Instances

Instances details
MonadZip Last

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Last a -> Last b -> Last (a, b) #

mzipWith :: (a -> b -> c) -> Last a -> Last b -> Last c #

munzip :: Last (a, b) -> (Last a, Last b) #

GFoldable Last # 
Instance details

Defined in Generics.Deriving.Foldable

Methods

gfoldMap :: Monoid m => (a -> m) -> Last a -> m #

gfold :: Monoid m => Last m -> m #

gfoldr :: (a -> b -> b) -> b -> Last a -> b #

gfoldr' :: (a -> b -> b) -> b -> Last a -> b #

gfoldl :: (a -> b -> a) -> a -> Last b -> a #

gfoldl' :: (a -> b -> a) -> a -> Last b -> a #

gfoldr1 :: (a -> a -> a) -> Last a -> a #

gfoldl1 :: (a -> a -> a) -> Last a -> a #

GFunctor Last # 
Instance details

Defined in Generics.Deriving.Functor

Methods

gmap :: (a -> b) -> Last a -> Last b #

GTraversable Last # 
Instance details

Defined in Generics.Deriving.Traversable

Methods

gtraverse :: Applicative f => (a -> f b) -> Last a -> f (Last b) #

gsequenceA :: Applicative f => Last (f a) -> f (Last a) #

gmapM :: Monad m => (a -> m b) -> Last a -> m (Last b) #

gsequence :: Monad m => Last (m a) -> m (Last a) #

Applicative Last

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

pure :: a -> Last a #

(<*>) :: Last (a -> b) -> Last a -> Last b #

liftA2 :: (a -> b -> c) -> Last a -> Last b -> Last c #

(*>) :: Last a -> Last b -> Last b #

(<*) :: Last a -> Last b -> Last a #

Functor Last

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

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

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

Monad Last

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

(>>=) :: Last a -> (a -> Last b) -> Last b #

(>>) :: Last a -> Last b -> Last b #

return :: a -> Last a #

Foldable Last

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

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

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

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

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

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

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

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

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

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

toList :: Last a -> [a] #

null :: Last a -> Bool #

length :: Last a -> Int #

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

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

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

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

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

Traversable Last

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Traversable

Methods

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

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

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

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

Generic1 Last 
Instance details

Defined in GHC.Internal.Data.Monoid

Associated Types

type Rep1 Last

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

type Rep1 Last = D1 ('MetaData "Last" "GHC.Internal.Data.Monoid" "ghc-internal" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 Maybe)))

Methods

from1 :: Last a -> Rep1 Last a #

to1 :: Rep1 Last a -> Last a #

GEnum a => GEnum (Last a) # 
Instance details

Defined in Generics.Deriving.Enum

Methods

genum :: [Last a] #

(GEq a, GEnum a, GIx a) => GIx (Last a) # 
Instance details

Defined in Generics.Deriving.Enum

Methods

range :: (Last a, Last a) -> [Last a] #

index :: (Last a, Last a) -> Last a -> Int #

inRange :: (Last a, Last a) -> Last a -> Bool #

GEq a => GEq (Last a) # 
Instance details

Defined in Generics.Deriving.Eq

Methods

geq :: Last a -> Last a -> Bool #

GMonoid (Last a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Last a #

gmappend :: Last a -> Last a -> Last a #

gmconcat :: [Last a] -> Last a #

GSemigroup (Last a) # 
Instance details

Defined in Generics.Deriving.Semigroup.Internal

Methods

gsappend :: Last a -> Last a -> Last a #

gstimes :: Integral b => b -> Last a -> Last a #

gsconcat :: NonEmpty (Last a) -> Last a #

GShow a => GShow (Last a) # 
Instance details

Defined in Generics.Deriving.Show

Methods

gshowsPrec :: Int -> Last a -> ShowS #

gshows :: Last a -> ShowS #

gshow :: Last a -> String #

gshowList :: [Last a] -> ShowS #

Monoid (Last a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

mempty :: Last a #

mappend :: Last a -> Last a -> Last a #

mconcat :: [Last a] -> Last a #

Semigroup (Last a)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

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

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

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

Generic (Last a) 
Instance details

Defined in GHC.Internal.Data.Monoid

Associated Types

type Rep (Last a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

type Rep (Last a) = D1 ('MetaData "Last" "GHC.Internal.Data.Monoid" "ghc-internal" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a))))

Methods

from :: Last a -> Rep (Last a) x #

to :: Rep (Last a) x -> Last a #

Read a => Read (Last a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Monoid

Show a => Show (Last a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

showsPrec :: Int -> Last a -> ShowS #

show :: Last a -> String #

showList :: [Last a] -> ShowS #

Eq a => Eq (Last a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

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

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

Ord a => Ord (Last a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

compare :: Last a -> Last a -> Ordering #

(<) :: Last a -> Last a -> Bool #

(<=) :: Last a -> Last a -> Bool #

(>) :: Last a -> Last a -> Bool #

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

max :: Last a -> Last a -> Last a #

min :: Last a -> Last a -> Last a #

type Rep1 Last

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

type Rep1 Last = D1 ('MetaData "Last" "GHC.Internal.Data.Monoid" "ghc-internal" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 Maybe)))
type Rep (Last a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

type Rep (Last a) = D1 ('MetaData "Last" "GHC.Internal.Data.Monoid" "ghc-internal" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a))))

newtype First a #

Maybe monoid returning the leftmost non-Nothing value.

First a is isomorphic to Alt Maybe a, but precedes it historically.

Beware that Data.Monoid.First is different from Data.Semigroup.First. The former returns the first non-Nothing, so Data.Monoid.First Nothing <> x = x. The latter simply returns the first value, thus Data.Semigroup.First Nothing <> x = Data.Semigroup.First Nothing.

Examples

Expand
>>> First (Just "hello") <> First Nothing <> First (Just "world")
First {getFirst = Just "hello"}
>>> First Nothing <> mempty
First {getFirst = Nothing}

Constructors

First 

Fields

Instances

Instances details
MonadZip First

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: First a -> First b -> First (a, b) #

mzipWith :: (a -> b -> c) -> First a -> First b -> First c #

munzip :: First (a, b) -> (First a, First b) #

GFoldable First # 
Instance details

Defined in Generics.Deriving.Foldable

Methods

gfoldMap :: Monoid m => (a -> m) -> First a -> m #

gfold :: Monoid m => First m -> m #

gfoldr :: (a -> b -> b) -> b -> First a -> b #

gfoldr' :: (a -> b -> b) -> b -> First a -> b #

gfoldl :: (a -> b -> a) -> a -> First b -> a #

gfoldl' :: (a -> b -> a) -> a -> First b -> a #

gfoldr1 :: (a -> a -> a) -> First a -> a #

gfoldl1 :: (a -> a -> a) -> First a -> a #

GFunctor First # 
Instance details

Defined in Generics.Deriving.Functor

Methods

gmap :: (a -> b) -> First a -> First b #

GTraversable First # 
Instance details

Defined in Generics.Deriving.Traversable

Methods

gtraverse :: Applicative f => (a -> f b) -> First a -> f (First b) #

gsequenceA :: Applicative f => First (f a) -> f (First a) #

gmapM :: Monad m => (a -> m b) -> First a -> m (First b) #

gsequence :: Monad m => First (m a) -> m (First a) #

Applicative First

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

pure :: a -> First a #

(<*>) :: First (a -> b) -> First a -> First b #

liftA2 :: (a -> b -> c) -> First a -> First b -> First c #

(*>) :: First a -> First b -> First b #

(<*) :: First a -> First b -> First a #

Functor First

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

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

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

Monad First

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

(>>=) :: First a -> (a -> First b) -> First b #

(>>) :: First a -> First b -> First b #

return :: a -> First a #

Foldable First

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

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

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

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

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

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

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

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

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

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

toList :: First a -> [a] #

null :: First a -> Bool #

length :: First a -> Int #

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

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

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

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

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

Traversable First

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Traversable

Methods

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

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

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

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

Generic1 First 
Instance details

Defined in GHC.Internal.Data.Monoid

Associated Types

type Rep1 First

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

type Rep1 First = D1 ('MetaData "First" "GHC.Internal.Data.Monoid" "ghc-internal" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 Maybe)))

Methods

from1 :: First a -> Rep1 First a #

to1 :: Rep1 First a -> First a #

GEnum a => GEnum (First a) # 
Instance details

Defined in Generics.Deriving.Enum

Methods

genum :: [First a] #

(GEq a, GEnum a, GIx a) => GIx (First a) # 
Instance details

Defined in Generics.Deriving.Enum

Methods

range :: (First a, First a) -> [First a] #

index :: (First a, First a) -> First a -> Int #

inRange :: (First a, First a) -> First a -> Bool #

GEq a => GEq (First a) # 
Instance details

Defined in Generics.Deriving.Eq

Methods

geq :: First a -> First a -> Bool #

GMonoid (First a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: First a #

gmappend :: First a -> First a -> First a #

gmconcat :: [First a] -> First a #

GSemigroup (First a) # 
Instance details

Defined in Generics.Deriving.Semigroup.Internal

Methods

gsappend :: First a -> First a -> First a #

gstimes :: Integral b => b -> First a -> First a #

gsconcat :: NonEmpty (First a) -> First a #

GShow a => GShow (First a) # 
Instance details

Defined in Generics.Deriving.Show

Methods

gshowsPrec :: Int -> First a -> ShowS #

gshows :: First a -> ShowS #

gshow :: First a -> String #

gshowList :: [First a] -> ShowS #

Monoid (First a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

mempty :: First a #

mappend :: First a -> First a -> First a #

mconcat :: [First a] -> First a #

Semigroup (First a)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

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

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

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

Generic (First a) 
Instance details

Defined in GHC.Internal.Data.Monoid

Associated Types

type Rep (First a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

type Rep (First a) = D1 ('MetaData "First" "GHC.Internal.Data.Monoid" "ghc-internal" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a))))

Methods

from :: First a -> Rep (First a) x #

to :: Rep (First a) x -> First a #

Read a => Read (First a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Monoid

Show a => Show (First a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

showsPrec :: Int -> First a -> ShowS #

show :: First a -> String #

showList :: [First a] -> ShowS #

Eq a => Eq (First a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

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

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

Ord a => Ord (First a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

compare :: First a -> First a -> Ordering #

(<) :: First a -> First a -> Bool #

(<=) :: First a -> First a -> Bool #

(>) :: First a -> First a -> Bool #

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

max :: First a -> First a -> First a #

min :: First a -> First a -> First a #

type Rep1 First

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

type Rep1 First = D1 ('MetaData "First" "GHC.Internal.Data.Monoid" "ghc-internal" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 Maybe)))
type Rep (First a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

type Rep (First a) = D1 ('MetaData "First" "GHC.Internal.Data.Monoid" "ghc-internal" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a))))

(<>) :: Semigroup a => a -> a -> a infixr 6 #

An associative operation.

Examples

Expand
>>> [1,2,3] <> [4,5,6]
[1,2,3,4,5,6]
>>> Just [1, 2, 3] <> Just [4, 5, 6]
Just [1,2,3,4,5,6]
>>> putStr "Hello, " <> putStrLn "World!"
Hello, World!

class Semigroup a => Monoid a where #

The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following:

Right identity
x <> mempty = x
Left identity
mempty <> x = x
Associativity
x <> (y <> z) = (x <> y) <> z (Semigroup law)
Concatenation
mconcat = foldr (<>) mempty

You can alternatively define mconcat instead of mempty, in which case the laws are:

Unit
mconcat (pure x) = x
Multiplication
mconcat (join xss) = mconcat (fmap mconcat xss)
Subclass
mconcat (toList xs) = sconcat xs

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.

NOTE: Semigroup is a superclass of Monoid since base-4.11.0.0.

Minimal complete definition

mempty | mconcat

Methods

mempty :: a #

Identity of mappend

Examples

Expand
>>> "Hello world" <> mempty
"Hello world"
>>> mempty <> [1, 2, 3]
[1,2,3]

mappend :: a -> a -> a #

An associative operation

NOTE: This method is redundant and has the default implementation mappend = (<>) since base-4.11.0.0. Should it be implemented manually, since mappend is a synonym for (<>), it is expected that the two functions are defined the same way. In a future GHC release mappend will be removed from Monoid.

mconcat :: [a] -> a #

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.

>>> mconcat ["Hello", " ", "Haskell", "!"]
"Hello Haskell!"

Instances

Instances details
Monoid ByteArray

Since: base-4.17.0.0

Instance details

Defined in Data.Array.Byte

Monoid IntSet 
Instance details

Defined in Data.IntSet.Internal

Monoid All

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: All #

mappend :: All -> All -> All #

mconcat :: [All] -> All #

Monoid Any

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: Any #

mappend :: Any -> Any -> Any #

mconcat :: [Any] -> Any #

Monoid Ordering

@since base-2.01

Instance details

Defined in GHC.Internal.Base

Monoid ()

@since base-2.01

Instance details

Defined in GHC.Internal.Base

Methods

mempty :: () #

mappend :: () -> () -> () #

mconcat :: [()] -> () #

Monoid (Comparison a)

mempty on comparisons always returns EQ. Without newtypes this equals pure (pure EQ).

mempty :: Comparison a
mempty = Comparison _ _ -> EQ
Instance details

Defined in Data.Functor.Contravariant

Monoid (Equivalence a)

mempty on equivalences always returns True. Without newtypes this equals pure (pure True).

mempty :: Equivalence a
mempty = Equivalence _ _ -> True
Instance details

Defined in Data.Functor.Contravariant

Monoid (Predicate a)

mempty on predicates always returns True. Without newtypes this equals pure True.

mempty :: Predicate a
mempty = _ -> True
Instance details

Defined in Data.Functor.Contravariant

(Ord a, Bounded a) => Monoid (Max a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

mempty :: Max a #

mappend :: Max a -> Max a -> Max a #

mconcat :: [Max a] -> Max a #

(Ord a, Bounded a) => Monoid (Min a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

mempty :: Min a #

mappend :: Min a -> Min a -> Min a #

mconcat :: [Min a] -> Min a #

Monoid m => Monoid (WrappedMonoid m)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Monoid (IntMap a) 
Instance details

Defined in Data.IntMap.Internal

Methods

mempty :: IntMap a #

mappend :: IntMap a -> IntMap a -> IntMap a #

mconcat :: [IntMap a] -> IntMap a #

Monoid (Seq a) 
Instance details

Defined in Data.Sequence.Internal

Methods

mempty :: Seq a #

mappend :: Seq a -> Seq a -> Seq a #

mconcat :: [Seq a] -> Seq a #

Monoid (MergeSet a) 
Instance details

Defined in Data.Set.Internal

Methods

mempty :: MergeSet a #

mappend :: MergeSet a -> MergeSet a -> MergeSet a #

mconcat :: [MergeSet a] -> MergeSet a #

Ord a => Monoid (Set a) 
Instance details

Defined in Data.Set.Internal

Methods

mempty :: Set a #

mappend :: Set a -> Set a -> Set a #

mconcat :: [Set a] -> Set a #

Monoid a => Monoid (Identity a)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Functor.Identity

Methods

mempty :: Identity a #

mappend :: Identity a -> Identity a -> Identity a #

mconcat :: [Identity a] -> Identity a #

Monoid (First a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

mempty :: First a #

mappend :: First a -> First a -> First a #

mconcat :: [First a] -> First a #

Monoid (Last a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

mempty :: Last a #

mappend :: Last a -> Last a -> Last a #

mconcat :: [Last a] -> Last a #

Monoid a => Monoid (Down a)

@since base-4.11.0.0

Instance details

Defined in GHC.Internal.Data.Ord

Methods

mempty :: Down a #

mappend :: Down a -> Down a -> Down a #

mconcat :: [Down a] -> Down a #

Monoid a => Monoid (Dual a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: Dual a #

mappend :: Dual a -> Dual a -> Dual a #

mconcat :: [Dual a] -> Dual a #

Monoid (Endo a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: Endo a #

mappend :: Endo a -> Endo a -> Endo a #

mconcat :: [Endo a] -> Endo a #

Num a => Monoid (Product a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: Product a #

mappend :: Product a -> Product a -> Product a #

mconcat :: [Product a] -> Product a #

Num a => Monoid (Sum a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: Sum a #

mappend :: Sum a -> Sum a -> Sum a #

mconcat :: [Sum a] -> Sum a #

(Generic a, Monoid (Rep a ())) => Monoid (Generically a)

@since base-4.17.0.0

Instance details

Defined in GHC.Internal.Generics

Monoid p => Monoid (Par1 p)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Generics

Methods

mempty :: Par1 p #

mappend :: Par1 p -> Par1 p -> Par1 p #

mconcat :: [Par1 p] -> Par1 p #

Monoid a => Monoid (IO a)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Base

Methods

mempty :: IO a #

mappend :: IO a -> IO a -> IO a #

mconcat :: [IO a] -> IO a #

Monoid a => Monoid (Q a)

Since: template-haskell-2.17.0.0

Instance details

Defined in Language.Haskell.TH.Syntax

Methods

mempty :: Q a #

mappend :: Q a -> Q a -> Q a #

mconcat :: [Q a] -> Q a #

Semigroup a => Monoid (Maybe a)

Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S."

Since 4.11.0: constraint on inner a value generalised from Monoid to Semigroup.

@since base-2.01

Instance details

Defined in GHC.Internal.Base

Methods

mempty :: Maybe a #

mappend :: Maybe a -> Maybe a -> Maybe a #

mconcat :: [Maybe a] -> Maybe a #

Monoid a => Monoid (Solo a)

@since base-4.15

Instance details

Defined in GHC.Internal.Base

Methods

mempty :: Solo a #

mappend :: Solo a -> Solo a -> Solo a #

mconcat :: [Solo a] -> Solo a #

Monoid [a]

@since base-2.01

Instance details

Defined in GHC.Internal.Base

Methods

mempty :: [a] #

mappend :: [a] -> [a] -> [a] #

mconcat :: [[a]] -> [a] #

Monoid a => Monoid (Op a b)

mempty @(Op a b) without newtypes is mempty @(b->a) = _ -> mempty.

mempty :: Op a b
mempty = Op _ -> mempty
Instance details

Defined in Data.Functor.Contravariant

Methods

mempty :: Op a b #

mappend :: Op a b -> Op a b -> Op a b #

mconcat :: [Op a b] -> Op a b #

Ord k => Monoid (Map k v) 
Instance details

Defined in Data.Map.Internal

Methods

mempty :: Map k v #

mappend :: Map k v -> Map k v -> Map k v #

mconcat :: [Map k v] -> Map k v #

Monoid (Proxy s)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Proxy

Methods

mempty :: Proxy s #

mappend :: Proxy s -> Proxy s -> Proxy s #

mconcat :: [Proxy s] -> Proxy s #

Monoid (U1 p)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Generics

Methods

mempty :: U1 p #

mappend :: U1 p -> U1 p -> U1 p #

mconcat :: [U1 p] -> U1 p #

(Monoid a, Monoid b) => Monoid (a, b)

@since base-2.01

Instance details

Defined in GHC.Internal.Base

Methods

mempty :: (a, b) #

mappend :: (a, b) -> (a, b) -> (a, b) #

mconcat :: [(a, b)] -> (a, b) #

Monoid b => Monoid (a -> b)

@since base-2.01

Instance details

Defined in GHC.Internal.Base

Methods

mempty :: a -> b #

mappend :: (a -> b) -> (a -> b) -> a -> b #

mconcat :: [a -> b] -> a -> b #

Monoid a => Monoid (Const a b)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Functor.Const

Methods

mempty :: Const a b #

mappend :: Const a b -> Const a b -> Const a b #

mconcat :: [Const a b] -> Const a b #

(Applicative f, Monoid a) => Monoid (Ap f a)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

mempty :: Ap f a #

mappend :: Ap f a -> Ap f a -> Ap f a #

mconcat :: [Ap f a] -> Ap f a #

Alternative f => Monoid (Alt f a)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: Alt f a #

mappend :: Alt f a -> Alt f a -> Alt f a #

mconcat :: [Alt f a] -> Alt f a #

Monoid (f p) => Monoid (Rec1 f p)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Generics

Methods

mempty :: Rec1 f p #

mappend :: Rec1 f p -> Rec1 f p -> Rec1 f p #

mconcat :: [Rec1 f p] -> Rec1 f p #

(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c)

@since base-2.01

Instance details

Defined in GHC.Internal.Base

Methods

mempty :: (a, b, c) #

mappend :: (a, b, c) -> (a, b, c) -> (a, b, c) #

mconcat :: [(a, b, c)] -> (a, b, c) #

(Monoid (f a), Monoid (g a)) => Monoid (Product f g a)

Since: base-4.16.0.0

Instance details

Defined in Data.Functor.Product

Methods

mempty :: Product f g a #

mappend :: Product f g a -> Product f g a -> Product f g a #

mconcat :: [Product f g a] -> Product f g a #

(Monoid (f p), Monoid (g p)) => Monoid ((f :*: g) p)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Generics

Methods

mempty :: (f :*: g) p #

mappend :: (f :*: g) p -> (f :*: g) p -> (f :*: g) p #

mconcat :: [(f :*: g) p] -> (f :*: g) p #

Monoid c => Monoid (K1 i c p)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Generics

Methods

mempty :: K1 i c p #

mappend :: K1 i c p -> K1 i c p -> K1 i c p #

mconcat :: [K1 i c p] -> K1 i c p #

(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d)

@since base-2.01

Instance details

Defined in GHC.Internal.Base

Methods

mempty :: (a, b, c, d) #

mappend :: (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) #

mconcat :: [(a, b, c, d)] -> (a, b, c, d) #

Monoid (f (g a)) => Monoid (Compose f g a)

Since: base-4.16.0.0

Instance details

Defined in Data.Functor.Compose

Methods

mempty :: Compose f g a #

mappend :: Compose f g a -> Compose f g a -> Compose f g a #

mconcat :: [Compose f g a] -> Compose f g a #

Monoid (f (g p)) => Monoid ((f :.: g) p)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Generics

Methods

mempty :: (f :.: g) p #

mappend :: (f :.: g) p -> (f :.: g) p -> (f :.: g) p #

mconcat :: [(f :.: g) p] -> (f :.: g) p #

Monoid (f p) => Monoid (M1 i c f p)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Generics

Methods

mempty :: M1 i c f p #

mappend :: M1 i c f p -> M1 i c f p -> M1 i c f p #

mconcat :: [M1 i c f p] -> M1 i c f p #

(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e)

@since base-2.01

Instance details

Defined in GHC.Internal.Base

Methods

mempty :: (a, b, c, d, e) #

mappend :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) #

mconcat :: [(a, b, c, d, e)] -> (a, b, c, d, e) #

newtype Alt (f :: k -> Type) (a :: k) #

Monoid under <|>.

Alt l <> Alt r == Alt (l <|> r)

Examples

Expand
>>> Alt (Just 12) <> Alt (Just 24)
Alt {getAlt = Just 12}
>>> Alt Nothing <> Alt (Just 24)
Alt {getAlt = Just 24}

@since base-4.8.0.0

Constructors

Alt 

Fields

Instances

Instances details
Generic1 (Alt f :: k -> Type) 
Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Associated Types

type Rep1 (Alt f :: k -> Type)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep1 (Alt f :: k -> Type) = D1 ('MetaData "Alt" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Alt" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAlt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)))

Methods

from1 :: forall (a :: k). Alt f a -> Rep1 (Alt f) a #

to1 :: forall (a :: k). Rep1 (Alt f) a -> Alt f a #

MonadZip f => MonadZip (Alt f)

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Alt f a -> Alt f b -> Alt f (a, b) #

mzipWith :: (a -> b -> c) -> Alt f a -> Alt f b -> Alt f c #

munzip :: Alt f (a, b) -> (Alt f a, Alt f b) #

Foldable1 f => Foldable1 (Alt f)

Since: base-4.18.0.0

Instance details

Defined in Data.Foldable1

Methods

fold1 :: Semigroup m => Alt f m -> m #

foldMap1 :: Semigroup m => (a -> m) -> Alt f a -> m #

foldMap1' :: Semigroup m => (a -> m) -> Alt f a -> m #

toNonEmpty :: Alt f a -> NonEmpty a #

maximum :: Ord a => Alt f a -> a #

minimum :: Ord a => Alt f a -> a #

head :: Alt f a -> a #

last :: Alt f a -> a #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> Alt f a -> b #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Alt f a -> b #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> Alt f a -> b #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Alt f a -> b #

Contravariant f => Contravariant (Alt f) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> Alt f a -> Alt f a' #

(>$) :: b -> Alt f b -> Alt f a #

GCopoint f => GCopoint (Alt f) # 
Instance details

Defined in Generics.Deriving.Copoint

Methods

gcopoint :: Alt f a -> a #

GFunctor f => GFunctor (Alt f) # 
Instance details

Defined in Generics.Deriving.Functor

Methods

gmap :: (a -> b) -> Alt f a -> Alt f b #

Alternative f => Alternative (Alt f)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

empty :: Alt f a #

(<|>) :: Alt f a -> Alt f a -> Alt f a #

some :: Alt f a -> Alt f [a] #

many :: Alt f a -> Alt f [a] #

Applicative f => Applicative (Alt f)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

pure :: a -> Alt f a #

(<*>) :: Alt f (a -> b) -> Alt f a -> Alt f b #

liftA2 :: (a -> b -> c) -> Alt f a -> Alt f b -> Alt f c #

(*>) :: Alt f a -> Alt f b -> Alt f b #

(<*) :: Alt f a -> Alt f b -> Alt f a #

Functor f => Functor (Alt f)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

fmap :: (a -> b) -> Alt f a -> Alt f b #

(<$) :: a -> Alt f b -> Alt f a #

Monad f => Monad (Alt f)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

(>>=) :: Alt f a -> (a -> Alt f b) -> Alt f b #

(>>) :: Alt f a -> Alt f b -> Alt f b #

return :: a -> Alt f a #

MonadPlus f => MonadPlus (Alt f)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mzero :: Alt f a #

mplus :: Alt f a -> Alt f a -> Alt f a #

Foldable f => Foldable (Alt f)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Alt f m -> m #

foldMap :: Monoid m => (a -> m) -> Alt f a -> m #

foldMap' :: Monoid m => (a -> m) -> Alt f a -> m #

foldr :: (a -> b -> b) -> b -> Alt f a -> b #

foldr' :: (a -> b -> b) -> b -> Alt f a -> b #

foldl :: (b -> a -> b) -> b -> Alt f a -> b #

foldl' :: (b -> a -> b) -> b -> Alt f a -> b #

foldr1 :: (a -> a -> a) -> Alt f a -> a #

foldl1 :: (a -> a -> a) -> Alt f a -> a #

toList :: Alt f a -> [a] #

null :: Alt f a -> Bool #

length :: Alt f a -> Int #

elem :: Eq a => a -> Alt f a -> Bool #

maximum :: Ord a => Alt f a -> a #

minimum :: Ord a => Alt f a -> a #

sum :: Num a => Alt f a -> a #

product :: Num a => Alt f a -> a #

Traversable f => Traversable (Alt f)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Traversable

Methods

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

sequenceA :: Applicative f0 => Alt f (f0 a) -> f0 (Alt f a) #

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

sequence :: Monad m => Alt f (m a) -> m (Alt f a) #

GEnum (f a) => GEnum (Alt f a) # 
Instance details

Defined in Generics.Deriving.Enum

Methods

genum :: [Alt f a] #

(GEq (f a), GEnum (f a), GIx (f a)) => GIx (Alt f a) # 
Instance details

Defined in Generics.Deriving.Enum

Methods

range :: (Alt f a, Alt f a) -> [Alt f a] #

index :: (Alt f a, Alt f a) -> Alt f a -> Int #

inRange :: (Alt f a, Alt f a) -> Alt f a -> Bool #

GEq (f a) => GEq (Alt f a) # 
Instance details

Defined in Generics.Deriving.Eq

Methods

geq :: Alt f a -> Alt f a -> Bool #

Alternative f => GMonoid (Alt f a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Alt f a #

gmappend :: Alt f a -> Alt f a -> Alt f a #

gmconcat :: [Alt f a] -> Alt f a #

Alternative f => GSemigroup (Alt f a) # 
Instance details

Defined in Generics.Deriving.Semigroup.Internal

Methods

gsappend :: Alt f a -> Alt f a -> Alt f a #

gstimes :: Integral b => b -> Alt f a -> Alt f a #

gsconcat :: NonEmpty (Alt f a) -> Alt f a #

GShow (f a) => GShow (Alt f a) # 
Instance details

Defined in Generics.Deriving.Show

Methods

gshowsPrec :: Int -> Alt f a -> ShowS #

gshows :: Alt f a -> ShowS #

gshow :: Alt f a -> String #

gshowList :: [Alt f a] -> ShowS #

Alternative f => Monoid (Alt f a)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: Alt f a #

mappend :: Alt f a -> Alt f a -> Alt f a #

mconcat :: [Alt f a] -> Alt f a #

Alternative f => Semigroup (Alt f a)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

(<>) :: Alt f a -> Alt f a -> Alt f a #

sconcat :: NonEmpty (Alt f a) -> Alt f a #

stimes :: Integral b => b -> Alt f a -> Alt f a #

Enum (f a) => Enum (Alt f a)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

succ :: Alt f a -> Alt f a #

pred :: Alt f a -> Alt f a #

toEnum :: Int -> Alt f a #

fromEnum :: Alt f a -> Int #

enumFrom :: Alt f a -> [Alt f a] #

enumFromThen :: Alt f a -> Alt f a -> [Alt f a] #

enumFromTo :: Alt f a -> Alt f a -> [Alt f a] #

enumFromThenTo :: Alt f a -> Alt f a -> Alt f a -> [Alt f a] #

Generic (Alt f a) 
Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Associated Types

type Rep (Alt f a)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep (Alt f a) = D1 ('MetaData "Alt" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Alt" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAlt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a))))

Methods

from :: Alt f a -> Rep (Alt f a) x #

to :: Rep (Alt f a) x -> Alt f a #

Num (f a) => Num (Alt f a)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

(+) :: Alt f a -> Alt f a -> Alt f a #

(-) :: Alt f a -> Alt f a -> Alt f a #

(*) :: Alt f a -> Alt f a -> Alt f a #

negate :: Alt f a -> Alt f a #

abs :: Alt f a -> Alt f a #

signum :: Alt f a -> Alt f a #

fromInteger :: Integer -> Alt f a #

Read (f a) => Read (Alt f a)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

readsPrec :: Int -> ReadS (Alt f a) #

readList :: ReadS [Alt f a] #

readPrec :: ReadPrec (Alt f a) #

readListPrec :: ReadPrec [Alt f a] #

Show (f a) => Show (Alt f a)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

showsPrec :: Int -> Alt f a -> ShowS #

show :: Alt f a -> String #

showList :: [Alt f a] -> ShowS #

Eq (f a) => Eq (Alt f a)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

(==) :: Alt f a -> Alt f a -> Bool #

(/=) :: Alt f a -> Alt f a -> Bool #

Ord (f a) => Ord (Alt f a)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

compare :: Alt f a -> Alt f a -> Ordering #

(<) :: Alt f a -> Alt f a -> Bool #

(<=) :: Alt f a -> Alt f a -> Bool #

(>) :: Alt f a -> Alt f a -> Bool #

(>=) :: Alt f a -> Alt f a -> Bool #

max :: Alt f a -> Alt f a -> Alt f a #

min :: Alt f a -> Alt f a -> Alt f a #

type Rep1 (Alt f :: k -> Type)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep1 (Alt f :: k -> Type) = D1 ('MetaData "Alt" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Alt" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAlt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)))
type Rep (Alt f a)

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep (Alt f a) = D1 ('MetaData "Alt" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Alt" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAlt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a))))

newtype Product a #

Monoid under multiplication.

Product x <> Product y == Product (x * y)

Examples

Expand
>>> Product 3 <> Product 4 <> mempty
Product {getProduct = 12}
>>> mconcat [ Product n | n <- [2 .. 10]]
Product {getProduct = 3628800}

Constructors

Product 

Fields

Instances

Instances details
MonadZip Product

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Product a -> Product b -> Product (a, b) #

mzipWith :: (a -> b -> c) -> Product a -> Product b -> Product c #

munzip :: Product (a, b) -> (Product a, Product b) #

Foldable1 Product

Since: base-4.18.0.0

Instance details

Defined in Data.Foldable1

Methods

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

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

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

toNonEmpty :: Product a -> NonEmpty a #

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

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

head :: Product a -> a #

last :: Product a -> a #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> Product a -> b #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Product a -> b #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> Product a -> b #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Product a -> b #

GFoldable Product # 
Instance details

Defined in Generics.Deriving.Foldable

Methods

gfoldMap :: Monoid m => (a -> m) -> Product a -> m #

gfold :: Monoid m => Product m -> m #

gfoldr :: (a -> b -> b) -> b -> Product a -> b #

gfoldr' :: (a -> b -> b) -> b -> Product a -> b #

gfoldl :: (a -> b -> a) -> a -> Product b -> a #

gfoldl' :: (a -> b -> a) -> a -> Product b -> a #

gfoldr1 :: (a -> a -> a) -> Product a -> a #

gfoldl1 :: (a -> a -> a) -> Product a -> a #

GFunctor Product # 
Instance details

Defined in Generics.Deriving.Functor

Methods

gmap :: (a -> b) -> Product a -> Product b #

GTraversable Product # 
Instance details

Defined in Generics.Deriving.Traversable

Methods

gtraverse :: Applicative f => (a -> f b) -> Product a -> f (Product b) #

gsequenceA :: Applicative f => Product (f a) -> f (Product a) #

gmapM :: Monad m => (a -> m b) -> Product a -> m (Product b) #

gsequence :: Monad m => Product (m a) -> m (Product a) #

Applicative Product

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

pure :: a -> Product a #

(<*>) :: Product (a -> b) -> Product a -> Product b #

liftA2 :: (a -> b -> c) -> Product a -> Product b -> Product c #

(*>) :: Product a -> Product b -> Product b #

(<*) :: Product a -> Product b -> Product a #

Functor Product

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

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

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

Monad Product

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

(>>=) :: Product a -> (a -> Product b) -> Product b #

(>>) :: Product a -> Product b -> Product b #

return :: a -> Product a #

Foldable Product

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

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

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

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

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

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

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

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

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

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

toList :: Product a -> [a] #

null :: Product a -> Bool #

length :: Product a -> Int #

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

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

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

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

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

Traversable Product

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Traversable

Methods

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

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

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

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

Generic1 Product 
Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Associated Types

type Rep1 Product

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep1 Product = D1 ('MetaData "Product" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Product" 'PrefixI 'True) (S1 ('MetaSel ('Just "getProduct") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))

Methods

from1 :: Product a -> Rep1 Product a #

to1 :: Rep1 Product a -> Product a #

GEnum a => GEnum (Product a) # 
Instance details

Defined in Generics.Deriving.Enum

Methods

genum :: [Product a] #

(GEq a, GEnum a, GIx a) => GIx (Product a) # 
Instance details

Defined in Generics.Deriving.Enum

Methods

range :: (Product a, Product a) -> [Product a] #

index :: (Product a, Product a) -> Product a -> Int #

inRange :: (Product a, Product a) -> Product a -> Bool #

GEq a => GEq (Product a) # 
Instance details

Defined in Generics.Deriving.Eq

Methods

geq :: Product a -> Product a -> Bool #

Num a => GMonoid (Product a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Product a #

gmappend :: Product a -> Product a -> Product a #

gmconcat :: [Product a] -> Product a #

Num a => GSemigroup (Product a) # 
Instance details

Defined in Generics.Deriving.Semigroup.Internal

Methods

gsappend :: Product a -> Product a -> Product a #

gstimes :: Integral b => b -> Product a -> Product a #

gsconcat :: NonEmpty (Product a) -> Product a #

GShow a => GShow (Product a) # 
Instance details

Defined in Generics.Deriving.Show

Num a => Monoid (Product a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: Product a #

mappend :: Product a -> Product a -> Product a #

mconcat :: [Product a] -> Product a #

Num a => Semigroup (Product a)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

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

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

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

Bounded a => Bounded (Product a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Generic (Product a) 
Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Associated Types

type Rep (Product a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep (Product a) = D1 ('MetaData "Product" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Product" 'PrefixI 'True) (S1 ('MetaSel ('Just "getProduct") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

Methods

from :: Product a -> Rep (Product a) x #

to :: Rep (Product a) x -> Product a #

Num a => Num (Product a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

(+) :: Product a -> Product a -> Product a #

(-) :: Product a -> Product a -> Product a #

(*) :: Product a -> Product a -> Product a #

negate :: Product a -> Product a #

abs :: Product a -> Product a #

signum :: Product a -> Product a #

fromInteger :: Integer -> Product a #

Read a => Read (Product a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Show a => Show (Product a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

showsPrec :: Int -> Product a -> ShowS #

show :: Product a -> String #

showList :: [Product a] -> ShowS #

Eq a => Eq (Product a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

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

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

Ord a => Ord (Product a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

compare :: Product a -> Product a -> Ordering #

(<) :: Product a -> Product a -> Bool #

(<=) :: Product a -> Product a -> Bool #

(>) :: Product a -> Product a -> Bool #

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

max :: Product a -> Product a -> Product a #

min :: Product a -> Product a -> Product a #

type Rep1 Product

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep1 Product = D1 ('MetaData "Product" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Product" 'PrefixI 'True) (S1 ('MetaSel ('Just "getProduct") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
type Rep (Product a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep (Product a) = D1 ('MetaData "Product" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Product" 'PrefixI 'True) (S1 ('MetaSel ('Just "getProduct") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

newtype Sum a #

Monoid under addition.

Sum a <> Sum b = Sum (a + b)

Examples

Expand
>>> Sum 1 <> Sum 2 <> mempty
Sum {getSum = 3}
>>> mconcat [ Sum n | n <- [3 .. 9]]
Sum {getSum = 42}

Constructors

Sum 

Fields

Instances

Instances details
MonadZip Sum

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Sum a -> Sum b -> Sum (a, b) #

mzipWith :: (a -> b -> c) -> Sum a -> Sum b -> Sum c #

munzip :: Sum (a, b) -> (Sum a, Sum b) #

Foldable1 Sum

Since: base-4.18.0.0

Instance details

Defined in Data.Foldable1

Methods

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

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

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

toNonEmpty :: Sum a -> NonEmpty a #

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

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

head :: Sum a -> a #

last :: Sum a -> a #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> Sum a -> b #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Sum a -> b #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> Sum a -> b #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Sum a -> b #

GCopoint Sum # 
Instance details

Defined in Generics.Deriving.Copoint

Methods

gcopoint :: Sum a -> a #

GFoldable Sum # 
Instance details

Defined in Generics.Deriving.Foldable

Methods

gfoldMap :: Monoid m => (a -> m) -> Sum a -> m #

gfold :: Monoid m => Sum m -> m #

gfoldr :: (a -> b -> b) -> b -> Sum a -> b #

gfoldr' :: (a -> b -> b) -> b -> Sum a -> b #

gfoldl :: (a -> b -> a) -> a -> Sum b -> a #

gfoldl' :: (a -> b -> a) -> a -> Sum b -> a #

gfoldr1 :: (a -> a -> a) -> Sum a -> a #

gfoldl1 :: (a -> a -> a) -> Sum a -> a #

GFunctor Sum # 
Instance details

Defined in Generics.Deriving.Functor

Methods

gmap :: (a -> b) -> Sum a -> Sum b #

GTraversable Sum # 
Instance details

Defined in Generics.Deriving.Traversable

Methods

gtraverse :: Applicative f => (a -> f b) -> Sum a -> f (Sum b) #

gsequenceA :: Applicative f => Sum (f a) -> f (Sum a) #

gmapM :: Monad m => (a -> m b) -> Sum a -> m (Sum b) #

gsequence :: Monad m => Sum (m a) -> m (Sum a) #

Applicative Sum

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

pure :: a -> Sum a #

(<*>) :: Sum (a -> b) -> Sum a -> Sum b #

liftA2 :: (a -> b -> c) -> Sum a -> Sum b -> Sum c #

(*>) :: Sum a -> Sum b -> Sum b #

(<*) :: Sum a -> Sum b -> Sum a #

Functor Sum

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

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

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

Monad Sum

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

(>>=) :: Sum a -> (a -> Sum b) -> Sum b #

(>>) :: Sum a -> Sum b -> Sum b #

return :: a -> Sum a #

Foldable Sum

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

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

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

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

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

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

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

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

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

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

toList :: Sum a -> [a] #

null :: Sum a -> Bool #

length :: Sum a -> Int #

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

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

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

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

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

Traversable Sum

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Traversable

Methods

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

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

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

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

Generic1 Sum 
Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Associated Types

type Rep1 Sum

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep1 Sum = D1 ('MetaData "Sum" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Sum" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))

Methods

from1 :: Sum a -> Rep1 Sum a #

to1 :: Rep1 Sum a -> Sum a #

GEnum a => GEnum (Sum a) # 
Instance details

Defined in Generics.Deriving.Enum

Methods

genum :: [Sum a] #

(GEq a, GEnum a, GIx a) => GIx (Sum a) # 
Instance details

Defined in Generics.Deriving.Enum

Methods

range :: (Sum a, Sum a) -> [Sum a] #

index :: (Sum a, Sum a) -> Sum a -> Int #

inRange :: (Sum a, Sum a) -> Sum a -> Bool #

GEq a => GEq (Sum a) # 
Instance details

Defined in Generics.Deriving.Eq

Methods

geq :: Sum a -> Sum a -> Bool #

Num a => GMonoid (Sum a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Sum a #

gmappend :: Sum a -> Sum a -> Sum a #

gmconcat :: [Sum a] -> Sum a #

Num a => GSemigroup (Sum a) # 
Instance details

Defined in Generics.Deriving.Semigroup.Internal

Methods

gsappend :: Sum a -> Sum a -> Sum a #

gstimes :: Integral b => b -> Sum a -> Sum a #

gsconcat :: NonEmpty (Sum a) -> Sum a #

GShow a => GShow (Sum a) # 
Instance details

Defined in Generics.Deriving.Show

Methods

gshowsPrec :: Int -> Sum a -> ShowS #

gshows :: Sum a -> ShowS #

gshow :: Sum a -> String #

gshowList :: [Sum a] -> ShowS #

Num a => Monoid (Sum a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: Sum a #

mappend :: Sum a -> Sum a -> Sum a #

mconcat :: [Sum a] -> Sum a #

Num a => Semigroup (Sum a)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

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

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

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

Bounded a => Bounded (Sum a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

minBound :: Sum a #

maxBound :: Sum a #

Generic (Sum a) 
Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Associated Types

type Rep (Sum a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep (Sum a) = D1 ('MetaData "Sum" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Sum" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

Methods

from :: Sum a -> Rep (Sum a) x #

to :: Rep (Sum a) x -> Sum a #

Num a => Num (Sum a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

(+) :: Sum a -> Sum a -> Sum a #

(-) :: Sum a -> Sum a -> Sum a #

(*) :: Sum a -> Sum a -> Sum a #

negate :: Sum a -> Sum a #

abs :: Sum a -> Sum a #

signum :: Sum a -> Sum a #

fromInteger :: Integer -> Sum a #

Read a => Read (Sum a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Show a => Show (Sum a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

showsPrec :: Int -> Sum a -> ShowS #

show :: Sum a -> String #

showList :: [Sum a] -> ShowS #

Eq a => Eq (Sum a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

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

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

Ord a => Ord (Sum a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

compare :: Sum a -> Sum a -> Ordering #

(<) :: Sum a -> Sum a -> Bool #

(<=) :: Sum a -> Sum a -> Bool #

(>) :: Sum a -> Sum a -> Bool #

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

max :: Sum a -> Sum a -> Sum a #

min :: Sum a -> Sum a -> Sum a #

type Rep1 Sum

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep1 Sum = D1 ('MetaData "Sum" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Sum" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
type Rep (Sum a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep (Sum a) = D1 ('MetaData "Sum" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Sum" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

newtype All #

Boolean monoid under conjunction (&&).

All x <> All y = All (x && y)

Examples

Expand
>>> All True <> mempty <> All False)
All {getAll = False}
>>> mconcat (map (\x -> All (even x)) [2,4,6,7,8])
All {getAll = False}
>>> All True <> mempty
All {getAll = True}

Constructors

All 

Fields

Instances

Instances details
GEnum All # 
Instance details

Defined in Generics.Deriving.Enum

Methods

genum :: [All] #

GIx All # 
Instance details

Defined in Generics.Deriving.Enum

Methods

range :: (All, All) -> [All] #

index :: (All, All) -> All -> Int #

inRange :: (All, All) -> All -> Bool #

GEq All # 
Instance details

Defined in Generics.Deriving.Eq

Methods

geq :: All -> All -> Bool #

GMonoid All # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: All #

gmappend :: All -> All -> All #

gmconcat :: [All] -> All #

GSemigroup All # 
Instance details

Defined in Generics.Deriving.Semigroup.Internal

Methods

gsappend :: All -> All -> All #

gstimes :: Integral b => b -> All -> All #

gsconcat :: NonEmpty All -> All #

GShow All # 
Instance details

Defined in Generics.Deriving.Show

Methods

gshowsPrec :: Int -> All -> ShowS #

gshows :: All -> ShowS #

gshow :: All -> String #

gshowList :: [All] -> ShowS #

Monoid All

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: All #

mappend :: All -> All -> All #

mconcat :: [All] -> All #

Semigroup All

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

(<>) :: All -> All -> All #

sconcat :: NonEmpty All -> All #

stimes :: Integral b => b -> All -> All #

Bounded All

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

minBound :: All #

maxBound :: All #

Generic All 
Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Associated Types

type Rep All

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep All = D1 ('MetaData "All" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "All" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAll") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))

Methods

from :: All -> Rep All x #

to :: Rep All x -> All #

Read All

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Show All

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

showsPrec :: Int -> All -> ShowS #

show :: All -> String #

showList :: [All] -> ShowS #

Eq All

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

(==) :: All -> All -> Bool #

(/=) :: All -> All -> Bool #

Ord All

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

compare :: All -> All -> Ordering #

(<) :: All -> All -> Bool #

(<=) :: All -> All -> Bool #

(>) :: All -> All -> Bool #

(>=) :: All -> All -> Bool #

max :: All -> All -> All #

min :: All -> All -> All #

type Rep All

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep All = D1 ('MetaData "All" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "All" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAll") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))

newtype Endo a #

The monoid of endomorphisms under composition.

Endo f <> Endo g == Endo (f . g)

Examples

Expand
>>> let computation = Endo ("Hello, " ++) <> Endo (++ "!")
>>> appEndo computation "Haskell"
"Hello, Haskell!"
>>> let computation = Endo (*3) <> Endo (+1)
>>> appEndo computation 1
6

Constructors

Endo 

Fields

Instances

Instances details
GMonoid (Endo a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Endo a #

gmappend :: Endo a -> Endo a -> Endo a #

gmconcat :: [Endo a] -> Endo a #

GSemigroup (Endo a) # 
Instance details

Defined in Generics.Deriving.Semigroup.Internal

Methods

gsappend :: Endo a -> Endo a -> Endo a #

gstimes :: Integral b => b -> Endo a -> Endo a #

gsconcat :: NonEmpty (Endo a) -> Endo a #

Monoid (Endo a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: Endo a #

mappend :: Endo a -> Endo a -> Endo a #

mconcat :: [Endo a] -> Endo a #

Semigroup (Endo a)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

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

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

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

Generic (Endo a) 
Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Associated Types

type Rep (Endo a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep (Endo a) = D1 ('MetaData "Endo" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Endo" 'PrefixI 'True) (S1 ('MetaSel ('Just "appEndo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (a -> a))))

Methods

from :: Endo a -> Rep (Endo a) x #

to :: Rep (Endo a) x -> Endo a #

type Rep (Endo a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep (Endo a) = D1 ('MetaData "Endo" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Endo" 'PrefixI 'True) (S1 ('MetaSel ('Just "appEndo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (a -> a))))

newtype Dual a #

The dual of a Monoid, obtained by swapping the arguments of (<>).

Dual a <> Dual b == Dual (b <> a)

Examples

Expand
>>> Dual "Hello" <> Dual "World"
Dual {getDual = "WorldHello"}
>>> Dual (Dual "Hello") <> Dual (Dual "World")
Dual {getDual = Dual {getDual = "HelloWorld"}}

Constructors

Dual 

Fields

Instances

Instances details
MonadZip Dual

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Dual a -> Dual b -> Dual (a, b) #

mzipWith :: (a -> b -> c) -> Dual a -> Dual b -> Dual c #

munzip :: Dual (a, b) -> (Dual a, Dual b) #

Foldable1 Dual

Since: base-4.18.0.0

Instance details

Defined in Data.Foldable1

Methods

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

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

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

toNonEmpty :: Dual a -> NonEmpty a #

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

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

head :: Dual a -> a #

last :: Dual a -> a #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> Dual a -> b #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Dual a -> b #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> Dual a -> b #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Dual a -> b #

GCopoint Dual # 
Instance details

Defined in Generics.Deriving.Copoint

Methods

gcopoint :: Dual a -> a #

GFoldable Dual # 
Instance details

Defined in Generics.Deriving.Foldable

Methods

gfoldMap :: Monoid m => (a -> m) -> Dual a -> m #

gfold :: Monoid m => Dual m -> m #

gfoldr :: (a -> b -> b) -> b -> Dual a -> b #

gfoldr' :: (a -> b -> b) -> b -> Dual a -> b #

gfoldl :: (a -> b -> a) -> a -> Dual b -> a #

gfoldl' :: (a -> b -> a) -> a -> Dual b -> a #

gfoldr1 :: (a -> a -> a) -> Dual a -> a #

gfoldl1 :: (a -> a -> a) -> Dual a -> a #

GFunctor Dual # 
Instance details

Defined in Generics.Deriving.Functor

Methods

gmap :: (a -> b) -> Dual a -> Dual b #

GTraversable Dual # 
Instance details

Defined in Generics.Deriving.Traversable

Methods

gtraverse :: Applicative f => (a -> f b) -> Dual a -> f (Dual b) #

gsequenceA :: Applicative f => Dual (f a) -> f (Dual a) #

gmapM :: Monad m => (a -> m b) -> Dual a -> m (Dual b) #

gsequence :: Monad m => Dual (m a) -> m (Dual a) #

Applicative Dual

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

pure :: a -> Dual a #

(<*>) :: Dual (a -> b) -> Dual a -> Dual b #

liftA2 :: (a -> b -> c) -> Dual a -> Dual b -> Dual c #

(*>) :: Dual a -> Dual b -> Dual b #

(<*) :: Dual a -> Dual b -> Dual a #

Functor Dual

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

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

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

Monad Dual

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

(>>=) :: Dual a -> (a -> Dual b) -> Dual b #

(>>) :: Dual a -> Dual b -> Dual b #

return :: a -> Dual a #

Foldable Dual

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

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

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

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

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

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

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

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

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

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

toList :: Dual a -> [a] #

null :: Dual a -> Bool #

length :: Dual a -> Int #

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

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

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

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

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

Traversable Dual

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Traversable

Methods

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

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

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

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

Generic1 Dual 
Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Associated Types

type Rep1 Dual

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep1 Dual = D1 ('MetaData "Dual" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Dual" 'PrefixI 'True) (S1 ('MetaSel ('Just "getDual") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))

Methods

from1 :: Dual a -> Rep1 Dual a #

to1 :: Rep1 Dual a -> Dual a #

GEnum a => GEnum (Dual a) # 
Instance details

Defined in Generics.Deriving.Enum

Methods

genum :: [Dual a] #

(GEq a, GEnum a, GIx a) => GIx (Dual a) # 
Instance details

Defined in Generics.Deriving.Enum

Methods

range :: (Dual a, Dual a) -> [Dual a] #

index :: (Dual a, Dual a) -> Dual a -> Int #

inRange :: (Dual a, Dual a) -> Dual a -> Bool #

GEq a => GEq (Dual a) # 
Instance details

Defined in Generics.Deriving.Eq

Methods

geq :: Dual a -> Dual a -> Bool #

GMonoid a => GMonoid (Dual a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Dual a #

gmappend :: Dual a -> Dual a -> Dual a #

gmconcat :: [Dual a] -> Dual a #

GSemigroup a => GSemigroup (Dual a) # 
Instance details

Defined in Generics.Deriving.Semigroup.Internal

Methods

gsappend :: Dual a -> Dual a -> Dual a #

gstimes :: Integral b => b -> Dual a -> Dual a #

gsconcat :: NonEmpty (Dual a) -> Dual a #

GShow a => GShow (Dual a) # 
Instance details

Defined in Generics.Deriving.Show

Methods

gshowsPrec :: Int -> Dual a -> ShowS #

gshows :: Dual a -> ShowS #

gshow :: Dual a -> String #

gshowList :: [Dual a] -> ShowS #

Monoid a => Monoid (Dual a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

mempty :: Dual a #

mappend :: Dual a -> Dual a -> Dual a #

mconcat :: [Dual a] -> Dual a #

Semigroup a => Semigroup (Dual a)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

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

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

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

Bounded a => Bounded (Dual a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

minBound :: Dual a #

maxBound :: Dual a #

Generic (Dual a) 
Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Associated Types

type Rep (Dual a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep (Dual a) = D1 ('MetaData "Dual" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Dual" 'PrefixI 'True) (S1 ('MetaSel ('Just "getDual") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

Methods

from :: Dual a -> Rep (Dual a) x #

to :: Rep (Dual a) x -> Dual a #

Read a => Read (Dual a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Show a => Show (Dual a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

showsPrec :: Int -> Dual a -> ShowS #

show :: Dual a -> String #

showList :: [Dual a] -> ShowS #

Eq a => Eq (Dual a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

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

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

Ord a => Ord (Dual a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

compare :: Dual a -> Dual a -> Ordering #

(<) :: Dual a -> Dual a -> Bool #

(<=) :: Dual a -> Dual a -> Bool #

(>) :: Dual a -> Dual a -> Bool #

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

max :: Dual a -> Dual a -> Dual a #

min :: Dual a -> Dual a -> Dual a #

type Rep1 Dual

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep1 Dual = D1 ('MetaData "Dual" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Dual" 'PrefixI 'True) (S1 ('MetaSel ('Just "getDual") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
type Rep (Dual a)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

type Rep (Dual a) = D1 ('MetaData "Dual" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Dual" 'PrefixI 'True) (S1 ('MetaSel ('Just "getDual") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

newtype Ap (f :: k -> Type) (a :: k) #

This data type witnesses the lifting of a Monoid into an Applicative pointwise.

Examples

Expand
>>> Ap (Just [1, 2, 3]) <> Ap Nothing
Ap {getAp = Nothing}
>>> Ap [Sum 10, Sum 20] <> Ap [Sum 1, Sum 2]
Ap {getAp = [Sum {getSum = 11},Sum {getSum = 12},Sum {getSum = 21},Sum {getSum = 22}]}

@since base-4.12.0.0

Constructors

Ap 

Fields

Instances

Instances details
Generic1 (Ap f :: k -> Type) 
Instance details

Defined in GHC.Internal.Data.Monoid

Associated Types

type Rep1 (Ap f :: k -> Type)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

type Rep1 (Ap f :: k -> Type) = D1 ('MetaData "Ap" "GHC.Internal.Data.Monoid" "ghc-internal" 'True) (C1 ('MetaCons "Ap" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)))

Methods

from1 :: forall (a :: k). Ap f a -> Rep1 (Ap f) a #

to1 :: forall (a :: k). Rep1 (Ap f) a -> Ap f a #

Foldable1 f => Foldable1 (Ap f)

Since: base-4.18.0.0

Instance details

Defined in Data.Foldable1

Methods

fold1 :: Semigroup m => Ap f m -> m #

foldMap1 :: Semigroup m => (a -> m) -> Ap f a -> m #

foldMap1' :: Semigroup m => (a -> m) -> Ap f a -> m #

toNonEmpty :: Ap f a -> NonEmpty a #

maximum :: Ord a => Ap f a -> a #

minimum :: Ord a => Ap f a -> a #

head :: Ap f a -> a #

last :: Ap f a -> a #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> Ap f a -> b #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Ap f a -> b #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> Ap f a -> b #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Ap f a -> b #

Alternative f => Alternative (Ap f)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

empty :: Ap f a #

(<|>) :: Ap f a -> Ap f a -> Ap f a #

some :: Ap f a -> Ap f [a] #

many :: Ap f a -> Ap f [a] #

Applicative f => Applicative (Ap f)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

pure :: a -> Ap f a #

(<*>) :: Ap f (a -> b) -> Ap f a -> Ap f b #

liftA2 :: (a -> b -> c) -> Ap f a -> Ap f b -> Ap f c #

(*>) :: Ap f a -> Ap f b -> Ap f b #

(<*) :: Ap f a -> Ap f b -> Ap f a #

Functor f => Functor (Ap f)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

fmap :: (a -> b) -> Ap f a -> Ap f b #

(<$) :: a -> Ap f b -> Ap f a #

Monad f => Monad (Ap f)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

(>>=) :: Ap f a -> (a -> Ap f b) -> Ap f b #

(>>) :: Ap f a -> Ap f b -> Ap f b #

return :: a -> Ap f a #

MonadPlus f => MonadPlus (Ap f)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

mzero :: Ap f a #

mplus :: Ap f a -> Ap f a -> Ap f a #

MonadFail f => MonadFail (Ap f)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

fail :: String -> Ap f a #

Foldable f => Foldable (Ap f)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Ap f m -> m #

foldMap :: Monoid m => (a -> m) -> Ap f a -> m #

foldMap' :: Monoid m => (a -> m) -> Ap f a -> m #

foldr :: (a -> b -> b) -> b -> Ap f a -> b #

foldr' :: (a -> b -> b) -> b -> Ap f a -> b #

foldl :: (b -> a -> b) -> b -> Ap f a -> b #

foldl' :: (b -> a -> b) -> b -> Ap f a -> b #

foldr1 :: (a -> a -> a) -> Ap f a -> a #

foldl1 :: (a -> a -> a) -> Ap f a -> a #

toList :: Ap f a -> [a] #

null :: Ap f a -> Bool #

length :: Ap f a -> Int #

elem :: Eq a => a -> Ap f a -> Bool #

maximum :: Ord a => Ap f a -> a #

minimum :: Ord a => Ap f a -> a #

sum :: Num a => Ap f a -> a #

product :: Num a => Ap f a -> a #

Traversable f => Traversable (Ap f)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Traversable

Methods

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

sequenceA :: Applicative f0 => Ap f (f0 a) -> f0 (Ap f a) #

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

sequence :: Monad m => Ap f (m a) -> m (Ap f a) #

(Applicative f, Monoid a) => Monoid (Ap f a)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

mempty :: Ap f a #

mappend :: Ap f a -> Ap f a -> Ap f a #

mconcat :: [Ap f a] -> Ap f a #

(Applicative f, Semigroup a) => Semigroup (Ap f a)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

(<>) :: Ap f a -> Ap f a -> Ap f a #

sconcat :: NonEmpty (Ap f a) -> Ap f a #

stimes :: Integral b => b -> Ap f a -> Ap f a #

(Applicative f, Bounded a) => Bounded (Ap f a)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

minBound :: Ap f a #

maxBound :: Ap f a #

Enum (f a) => Enum (Ap f a)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

succ :: Ap f a -> Ap f a #

pred :: Ap f a -> Ap f a #

toEnum :: Int -> Ap f a #

fromEnum :: Ap f a -> Int #

enumFrom :: Ap f a -> [Ap f a] #

enumFromThen :: Ap f a -> Ap f a -> [Ap f a] #

enumFromTo :: Ap f a -> Ap f a -> [Ap f a] #

enumFromThenTo :: Ap f a -> Ap f a -> Ap f a -> [Ap f a] #

Generic (Ap f a) 
Instance details

Defined in GHC.Internal.Data.Monoid

Associated Types

type Rep (Ap f a)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

type Rep (Ap f a) = D1 ('MetaData "Ap" "GHC.Internal.Data.Monoid" "ghc-internal" 'True) (C1 ('MetaCons "Ap" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a))))

Methods

from :: Ap f a -> Rep (Ap f a) x #

to :: Rep (Ap f a) x -> Ap f a #

(Applicative f, Num a) => Num (Ap f a)

Note that even if the underlying Num and Applicative instances are lawful, for most Applicatives, this instance will not be lawful. If you use this instance with the list Applicative, the following customary laws will not hold:

Commutativity:

>>> Ap [10,20] + Ap [1,2]
Ap {getAp = [11,12,21,22]}
>>> Ap [1,2] + Ap [10,20]
Ap {getAp = [11,21,12,22]}

Additive inverse:

>>> Ap [] + negate (Ap [])
Ap {getAp = []}
>>> fromInteger 0 :: Ap [] Int
Ap {getAp = [0]}

Distributivity:

>>> Ap [1,2] * (3 + 4)
Ap {getAp = [7,14]}
>>> (Ap [1,2] * 3) + (Ap [1,2] * 4)
Ap {getAp = [7,11,10,14]}

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

(+) :: Ap f a -> Ap f a -> Ap f a #

(-) :: Ap f a -> Ap f a -> Ap f a #

(*) :: Ap f a -> Ap f a -> Ap f a #

negate :: Ap f a -> Ap f a #

abs :: Ap f a -> Ap f a #

signum :: Ap f a -> Ap f a #

fromInteger :: Integer -> Ap f a #

Read (f a) => Read (Ap f a)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

readsPrec :: Int -> ReadS (Ap f a) #

readList :: ReadS [Ap f a] #

readPrec :: ReadPrec (Ap f a) #

readListPrec :: ReadPrec [Ap f a] #

Show (f a) => Show (Ap f a)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

showsPrec :: Int -> Ap f a -> ShowS #

show :: Ap f a -> String #

showList :: [Ap f a] -> ShowS #

Eq (f a) => Eq (Ap f a)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

(==) :: Ap f a -> Ap f a -> Bool #

(/=) :: Ap f a -> Ap f a -> Bool #

Ord (f a) => Ord (Ap f a)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

compare :: Ap f a -> Ap f a -> Ordering #

(<) :: Ap f a -> Ap f a -> Bool #

(<=) :: Ap f a -> Ap f a -> Bool #

(>) :: Ap f a -> Ap f a -> Bool #

(>=) :: Ap f a -> Ap f a -> Bool #

max :: Ap f a -> Ap f a -> Ap f a #

min :: Ap f a -> Ap f a -> Ap f a #

type Rep1 (Ap f :: k -> Type)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

type Rep1 (Ap f :: k -> Type) = D1 ('MetaData "Ap" "GHC.Internal.Data.Monoid" "ghc-internal" 'True) (C1 ('MetaCons "Ap" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)))
type Rep (Ap f a)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

type Rep (Ap f a) = D1 ('MetaData "Ap" "GHC.Internal.Data.Monoid" "ghc-internal" 'True) (C1 ('MetaCons "Ap" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a))))

class GSemigroup a => GMonoid a where #

Minimal complete definition

Nothing

Methods

gmempty :: a #

Generic mempty

default gmempty :: (Generic a, GMonoid' (Rep a)) => a #

gmappend :: a -> a -> a #

Generic mappend

default gmappend :: (Generic a, GMonoid' (Rep a)) => a -> a -> a #

gmconcat :: [a] -> a #

Generic mconcat

Instances

Instances details
GMonoid All # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: All #

gmappend :: All -> All -> All #

gmconcat :: [All] -> All #

GMonoid Any # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Any #

gmappend :: Any -> Any -> Any #

gmconcat :: [Any] -> Any #

GMonoid Ordering # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

GMonoid () # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: () #

gmappend :: () -> () -> () #

gmconcat :: [()] -> () #

GMonoid m => GMonoid (WrappedMonoid m) # 
Instance details

Defined in Generics.Deriving.Monoid

(Generic a, GMonoid' (Rep a)) => GMonoid (Default a) # 
Instance details

Defined in Generics.Deriving.Default

Methods

gmempty :: Default a #

gmappend :: Default a -> Default a -> Default a #

gmconcat :: [Default a] -> Default a #

GMonoid a => GMonoid (Identity a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

GMonoid (First a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: First a #

gmappend :: First a -> First a -> First a #

gmconcat :: [First a] -> First a #

GMonoid (Last a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Last a #

gmappend :: Last a -> Last a -> Last a #

gmconcat :: [Last a] -> Last a #

GMonoid a => GMonoid (Down a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Down a #

gmappend :: Down a -> Down a -> Down a #

gmconcat :: [Down a] -> Down a #

GMonoid a => GMonoid (Dual a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Dual a #

gmappend :: Dual a -> Dual a -> Dual a #

gmconcat :: [Dual a] -> Dual a #

GMonoid (Endo a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Endo a #

gmappend :: Endo a -> Endo a -> Endo a #

gmconcat :: [Endo a] -> Endo a #

Num a => GMonoid (Product a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Product a #

gmappend :: Product a -> Product a -> Product a #

gmconcat :: [Product a] -> Product a #

Num a => GMonoid (Sum a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Sum a #

gmappend :: Sum a -> Sum a -> Sum a #

gmconcat :: [Sum a] -> Sum a #

GSemigroup a => GMonoid (Maybe a) # 
Instance details

Defined in Generics.Deriving.Monoid

Methods

gmempty :: Maybe a #

gmappend :: Maybe a -> Maybe a -> Maybe a #

gmconcat :: [Maybe a] -> Maybe a #

GMonoid [a] # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: [a] #

gmappend :: [a] -> [a] -> [a] #

gmconcat :: [[a]] -> [a] #

GMonoid (Proxy s) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Proxy s #

gmappend :: Proxy s -> Proxy s -> Proxy s #

gmconcat :: [Proxy s] -> Proxy s #

(GMonoid a, GMonoid b) => GMonoid (a, b) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: (a, b) #

gmappend :: (a, b) -> (a, b) -> (a, b) #

gmconcat :: [(a, b)] -> (a, b) #

GMonoid b => GMonoid (a -> b) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: a -> b #

gmappend :: (a -> b) -> (a -> b) -> a -> b #

gmconcat :: [a -> b] -> a -> b #

GMonoid a => GMonoid (Const a b) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Const a b #

gmappend :: Const a b -> Const a b -> Const a b #

gmconcat :: [Const a b] -> Const a b #

Alternative f => GMonoid (Alt f a) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: Alt f a #

gmappend :: Alt f a -> Alt f a -> Alt f a #

gmconcat :: [Alt f a] -> Alt f a #

(GMonoid a, GMonoid b, GMonoid c) => GMonoid (a, b, c) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: (a, b, c) #

gmappend :: (a, b, c) -> (a, b, c) -> (a, b, c) #

gmconcat :: [(a, b, c)] -> (a, b, c) #

(GMonoid a, GMonoid b, GMonoid c, GMonoid d) => GMonoid (a, b, c, d) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: (a, b, c, d) #

gmappend :: (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) #

gmconcat :: [(a, b, c, d)] -> (a, b, c, d) #

(GMonoid a, GMonoid b, GMonoid c, GMonoid d, GMonoid e) => GMonoid (a, b, c, d, e) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: (a, b, c, d, e) #

gmappend :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) #

gmconcat :: [(a, b, c, d, e)] -> (a, b, c, d, e) #

(GMonoid a, GMonoid b, GMonoid c, GMonoid d, GMonoid e, GMonoid f) => GMonoid (a, b, c, d, e, f) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: (a, b, c, d, e, f) #

gmappend :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) #

gmconcat :: [(a, b, c, d, e, f)] -> (a, b, c, d, e, f) #

(GMonoid a, GMonoid b, GMonoid c, GMonoid d, GMonoid e, GMonoid f, GMonoid g) => GMonoid (a, b, c, d, e, f, g) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: (a, b, c, d, e, f, g) #

gmappend :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) #

gmconcat :: [(a, b, c, d, e, f, g)] -> (a, b, c, d, e, f, g) #

(GMonoid a, GMonoid b, GMonoid c, GMonoid d, GMonoid e, GMonoid f, GMonoid g, GMonoid h) => GMonoid (a, b, c, d, e, f, g, h) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty :: (a, b, c, d, e, f, g, h) #

gmappend :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) #

gmconcat :: [(a, b, c, d, e, f, g, h)] -> (a, b, c, d, e, f, g, h) #

gmappenddefault :: (Generic a, GMonoid' (Rep a)) => a -> a -> a #

class GSemigroup' f => GMonoid' (f :: k -> Type) where #

Methods

gmempty' :: forall (x :: k). f x #

gmappend' :: forall (x :: k). f x -> f x -> f x #

Instances

Instances details
GMonoid' (U1 :: k -> Type) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty' :: forall (x :: k). U1 x #

gmappend' :: forall (x :: k). U1 x -> U1 x -> U1 x #

(GMonoid' f, GMonoid' h) => GMonoid' (f :*: h :: k -> Type) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty' :: forall (x :: k). (f :*: h) x #

gmappend' :: forall (x :: k). (f :*: h) x -> (f :*: h) x -> (f :*: h) x #

GMonoid a => GMonoid' (K1 i a :: k -> Type) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty' :: forall (x :: k). K1 i a x #

gmappend' :: forall (x :: k). K1 i a x -> K1 i a x -> K1 i a x #

GMonoid' f => GMonoid' (M1 i c f :: k -> Type) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

gmempty' :: forall (x :: k). M1 i c f x #

gmappend' :: forall (x :: k). M1 i c f x -> M1 i c f x -> M1 i c f x #

memptydefault :: (Generic a, Monoid' (Rep a)) => a #

mappenddefault :: (Generic a, Monoid' (Rep a)) => a -> a -> a #

class Monoid' (f :: k -> Type) where #

Methods

mempty' :: forall (x :: k). f x #

mappend' :: forall (x :: k). f x -> f x -> f x #

Instances

Instances details
Monoid' (U1 :: k -> Type) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

mempty' :: forall (x :: k). U1 x #

mappend' :: forall (x :: k). U1 x -> U1 x -> U1 x #

(Monoid' f, Monoid' h) => Monoid' (f :*: h :: k -> Type) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

mempty' :: forall (x :: k). (f :*: h) x #

mappend' :: forall (x :: k). (f :*: h) x -> (f :*: h) x -> (f :*: h) x #

Monoid a => Monoid' (K1 i a :: k -> Type) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

mempty' :: forall (x :: k). K1 i a x #

mappend' :: forall (x :: k). K1 i a x -> K1 i a x -> K1 i a x #

Monoid' f => Monoid' (M1 i c f :: k -> Type) # 
Instance details

Defined in Generics.Deriving.Monoid.Internal

Methods

mempty' :: forall (x :: k). M1 i c f x #

mappend' :: forall (x :: k). M1 i c f x -> M1 i c f x -> M1 i c f x #

Orphan instances

GMonoid m => GMonoid (WrappedMonoid m) # 
Instance details

GSemigroup a => GMonoid (Maybe a) # 
Instance details

Methods

gmempty :: Maybe a #

gmappend :: Maybe a -> Maybe a -> Maybe a #

gmconcat :: [Maybe a] -> Maybe a #