linear-base-0.5.0: Standard library for linear types.
Safe HaskellNone
LanguageHaskell2010

Data.Monoid.Linear

Description

This module provides linear versions of Monoid and related classes.

Synopsis

Documentation

mconcat :: Monoid a => [a] %1 -> a Source #

mappend :: Monoid a => a %1 -> a %1 -> a Source #

class Semigroup a => Monoid a where Source #

A linear monoid is a linear semigroup with an identity on the binary operation.

Laws (same as Monoid): * ∀ x ∈ G, x <> mempty = mempty <> x = x

Methods

mempty :: a Source #

Instances

Instances details
Monoid All Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: All Source #

Monoid Any Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Any Source #

Monoid Ordering Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Monoid () Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: () Source #

Monoid a => Monoid (Identity a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Identity a Source #

Consumable a => Monoid (First a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: First a Source #

Consumable a => Monoid (Last a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Last a Source #

Monoid a => Monoid (Down a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Down a Source #

Monoid a => Monoid (Dual a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Dual a Source #

MultIdentity a => Monoid (Product a) Source # 
Instance details

Defined in Data.Num.Linear

Methods

mempty :: Product a Source #

AddIdentity a => Monoid (Sum a) Source # 
Instance details

Defined in Data.Num.Linear

Methods

mempty :: Sum a Source #

Monoid (Array a) Source # 
Instance details

Defined in Data.Array.Polarized.Push

Methods

mempty :: Array a Source #

Monoid (Endo a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Endo a Source #

AddIdentity a => Monoid (Adding a) Source # 
Instance details

Defined in Data.Num.Linear

Methods

mempty :: Adding a Source #

MultIdentity a => Monoid (Multiplying a) Source # 
Instance details

Defined in Data.Num.Linear

(Movable a, Monoid a) => Monoid (MovableMonoid a) Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Instances

Monoid a => Monoid (Ur a) Source #

Useful to treat unrestricted monoids as linear ones.

Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Ur a Source #

Monoid a => Monoid (IO a) Source # 
Instance details

Defined in System.IO.Linear

Methods

mempty :: IO a Source #

Monoid a => Monoid (RIO a) Source # 
Instance details

Defined in System.IO.Resource.Linear.Internal

Methods

mempty :: RIO a Source #

Semigroup a => Monoid (Maybe a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Maybe a Source #

Monoid [a] Source # 
Instance details

Defined in Data.List.Linear

Methods

mempty :: [a] Source #

Monoid (Proxy a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Proxy a Source #

(Monoid a, Monoid b) => Monoid (a, b) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: (a, b) Source #

Monoid a => Monoid (Const a b) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Const a b Source #

(Applicative f, Monoid a) => Monoid (Ap f a) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

mempty :: Ap f a Source #

(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

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

(Monoid (f a), Monoid (g a)) => Monoid (Product f g a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Product f g a Source #

(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

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

Monoid (f (g a)) => Monoid (Compose f g a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Compose f g a Source #

(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

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

newtype First a #

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

Examples

Expand
>>> First 0 <> First 10
First 0
>>> sconcat $ First 1 :| [ First n | n <- [2 ..] ]
First 1

Constructors

First 

Fields

Instances

Instances details
Foldable1 First

Since: base-4.18.0.0

Instance details

Defined in Data.Foldable1

Methods

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

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

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

toNonEmpty :: First a -> NonEmpty a #

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

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

head :: First a -> a #

last :: First a -> a #

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

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

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

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

NFData1 First

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

Applicative First

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

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.9.0.0

Instance details

Defined in Data.Semigroup

Methods

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

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

Monad First

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

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

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

return :: a -> First a #

MonadFix First

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

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

Foldable First

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

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.9.0.0

Instance details

Defined in Data.Semigroup

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 Data.Semigroup

Associated Types

type Rep1 First

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

type Rep1 First = D1 ('MetaData "First" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))

Methods

from1 :: First a -> Rep1 First a #

to1 :: Rep1 First a -> First a #

Unbox a => Vector Vector (First a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicUnsafeFreeze :: Mutable Vector s (First a) -> ST s (Vector (First a))

basicUnsafeThaw :: Vector (First a) -> ST s (Mutable Vector s (First a))

basicLength :: Vector (First a) -> Int

basicUnsafeSlice :: Int -> Int -> Vector (First a) -> Vector (First a)

basicUnsafeIndexM :: Vector (First a) -> Int -> Box (First a)

basicUnsafeCopy :: Mutable Vector s (First a) -> Vector (First a) -> ST s ()

elemseq :: Vector (First a) -> First a -> b -> b

Unbox a => MVector MVector (First a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicLength :: MVector s (First a) -> Int

basicUnsafeSlice :: Int -> Int -> MVector s (First a) -> MVector s (First a)

basicOverlaps :: MVector s (First a) -> MVector s (First a) -> Bool

basicUnsafeNew :: Int -> ST s (MVector s (First a))

basicInitialize :: MVector s (First a) -> ST s ()

basicUnsafeReplicate :: Int -> First a -> ST s (MVector s (First a))

basicUnsafeRead :: MVector s (First a) -> Int -> ST s (First a)

basicUnsafeWrite :: MVector s (First a) -> Int -> First a -> ST s ()

basicClear :: MVector s (First a) -> ST s ()

basicSet :: MVector s (First a) -> First a -> ST s ()

basicUnsafeCopy :: MVector s (First a) -> MVector s (First a) -> ST s ()

basicUnsafeMove :: MVector s (First a) -> MVector s (First a) -> ST s ()

basicUnsafeGrow :: MVector s (First a) -> Int -> ST s (MVector s (First a))

NFData a => NFData (First a)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: First a -> () #

Semigroup (First a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

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

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

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

Data a => Data (First a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> First a -> c (First a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (First a) #

toConstr :: First a -> Constr #

dataTypeOf :: First a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (First a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (First a)) #

gmapT :: (forall b. Data b => b -> b) -> First a -> First a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> First a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> First a -> r #

gmapQ :: (forall d. Data d => d -> u) -> First a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> First a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> First a -> m (First a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> First a -> m (First a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> First a -> m (First a) #

Bounded a => Bounded (First a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

minBound :: First a #

maxBound :: First a #

Enum a => Enum (First a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

succ :: First a -> First a #

pred :: First a -> First a #

toEnum :: Int -> First a #

fromEnum :: First a -> Int #

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

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

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

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

Generic (First a) 
Instance details

Defined in Data.Semigroup

Associated Types

type Rep (First a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

type Rep (First a) = D1 ('MetaData "First" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

Methods

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

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

Read a => Read (First a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Show a => Show (First a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

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

show :: First a -> String #

showList :: [First a] -> ShowS #

Eq a => Eq (First a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

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

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

Ord a => Ord (First a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

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 #

Hashable a => Hashable (First a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> First a -> Int #

hash :: First a -> Int #

Consumable a => Semigroup (First a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: First a %1 -> First a %1 -> First a Source #

Consumable a => Consumable (First a) Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Consumable

Methods

consume :: First a %1 -> () Source #

Prim a => Prim (First a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Unbox a => Unbox (First a) 
Instance details

Defined in Data.Vector.Unboxed.Base

type Rep1 First

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

type Rep1 First = D1 ('MetaData "First" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
type Rep1 First 
Instance details

Defined in Generics.Linear.Instances.Base

type Rep1 First = D1 ('MetaData "First" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
newtype MVector s (First a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s (First a) = MV_First (MVector s a)
type Rep (First a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

type Rep (First a) = D1 ('MetaData "First" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type Rep (First a) 
Instance details

Defined in Generics.Linear.Instances.Base

type Rep (First a) = D1 ('MetaData "First" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
newtype Vector (First a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype Vector (First a) = V_First (Vector a)

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
NFData Any

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Any -> () #

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 #

Monoid Any Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Any Source #

Semigroup Any Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Any %1 -> Any %1 -> Any Source #

Consumable Any Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Consumable

Methods

consume :: Any %1 -> () Source #

Dupable Any Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Dupable

Methods

dupR :: Any %1 -> Replicator Any Source #

dup2 :: Any %1 -> (Any, Any) Source #

Movable Any Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Movable

Methods

move :: Any %1 -> Ur Any Source #

Unbox Any 
Instance details

Defined in Data.Vector.Unboxed.Base

Vector Vector Any 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicUnsafeFreeze :: Mutable Vector s Any -> ST s (Vector Any)

basicUnsafeThaw :: Vector Any -> ST s (Mutable Vector s Any)

basicLength :: Vector Any -> Int

basicUnsafeSlice :: Int -> Int -> Vector Any -> Vector Any

basicUnsafeIndexM :: Vector Any -> Int -> Box Any

basicUnsafeCopy :: Mutable Vector s Any -> Vector Any -> ST s ()

elemseq :: Vector Any -> Any -> b -> b

MVector MVector Any 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicLength :: MVector s Any -> Int

basicUnsafeSlice :: Int -> Int -> MVector s Any -> MVector s Any

basicOverlaps :: MVector s Any -> MVector s Any -> Bool

basicUnsafeNew :: Int -> ST s (MVector s Any)

basicInitialize :: MVector s Any -> ST s ()

basicUnsafeReplicate :: Int -> Any -> ST s (MVector s Any)

basicUnsafeRead :: MVector s Any -> Int -> ST s Any

basicUnsafeWrite :: MVector s Any -> Int -> Any -> ST s ()

basicClear :: MVector s Any -> ST s ()

basicSet :: MVector s Any -> Any -> ST s ()

basicUnsafeCopy :: MVector s Any -> MVector s Any -> ST s ()

basicUnsafeMove :: MVector s Any -> MVector s Any -> ST s ()

basicUnsafeGrow :: MVector s Any -> Int -> ST s (MVector s 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)))
type Rep Any 
Instance details

Defined in Generics.Linear.Instances.Base

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 Vector Any 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype Vector Any = V_Any (Vector Bool)
newtype MVector s Any 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s Any = MV_Any (MVector s Bool)

class Semigroup a where Source #

A linear semigroup a is a type with an associative binary operation <> that linearly consumes two as.

Laws (same as Semigroup): * ∀ x ∈ G, y ∈ G, z ∈ G, x <> (y <> z) = (x <> y) <> z

Methods

(<>) :: a %1 -> a %1 -> a infixr 6 Source #

Instances

Instances details
Semigroup Void Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Void %1 -> Void %1 -> Void Source #

Semigroup All Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: All %1 -> All %1 -> All Source #

Semigroup Any Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Any %1 -> Any %1 -> Any Source #

Semigroup Ordering Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Ordering %1 -> Ordering %1 -> Ordering Source #

Semigroup () Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: () %1 -> () %1 -> () Source #

Consumable a => Semigroup (First a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: First a %1 -> First a %1 -> First a Source #

Consumable a => Semigroup (Last a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Last a %1 -> Last a %1 -> Last a Source #

Semigroup (NonEmpty a) Source # 
Instance details

Defined in Data.List.Linear

Methods

(<>) :: NonEmpty a %1 -> NonEmpty a %1 -> NonEmpty a Source #

Semigroup a => Semigroup (Identity a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Identity a %1 -> Identity a %1 -> Identity a Source #

Consumable a => Semigroup (First a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: First a %1 -> First a %1 -> First a Source #

Consumable a => Semigroup (Last a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Last a %1 -> Last a %1 -> Last a Source #

Semigroup a => Semigroup (Down a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Down a %1 -> Down a %1 -> Down a Source #

Semigroup a => Semigroup (Dual a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Dual a %1 -> Dual a %1 -> Dual a Source #

Multiplicative a => Semigroup (Product a) Source # 
Instance details

Defined in Data.Num.Linear

Methods

(<>) :: Product a %1 -> Product a %1 -> Product a Source #

Additive a => Semigroup (Sum a) Source # 
Instance details

Defined in Data.Num.Linear

Methods

(<>) :: Sum a %1 -> Sum a %1 -> Sum a Source #

Semigroup (Array a) Source # 
Instance details

Defined in Data.Array.Polarized.Pull.Internal

Methods

(<>) :: Array a %1 -> Array a %1 -> Array a Source #

Semigroup (Array a) Source # 
Instance details

Defined in Data.Array.Polarized.Push

Methods

(<>) :: Array a %1 -> Array a %1 -> Array a Source #

Semigroup (Endo a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Endo a %1 -> Endo a %1 -> Endo a Source #

Additive a => Semigroup (Adding a) Source # 
Instance details

Defined in Data.Num.Linear

Methods

(<>) :: Adding a %1 -> Adding a %1 -> Adding a Source #

Multiplicative a => Semigroup (Multiplying a) Source # 
Instance details

Defined in Data.Num.Linear

Methods

(<>) :: Multiplying a %1 -> Multiplying a %1 -> Multiplying a Source #

Keyed a => Semigroup (Set a) Source # 
Instance details

Defined in Data.Set.Mutable.Linear.Internal

Methods

(<>) :: Set a %1 -> Set a %1 -> Set a Source #

(Movable a, Semigroup a) => Semigroup (MovableMonoid a) Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Instances

Semigroup a => Semigroup (Ur a) Source #

Useful to treat unrestricted semigroups as linear ones.

Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Ur a %1 -> Ur a %1 -> Ur a Source #

Semigroup (Vector a) Source # 
Instance details

Defined in Data.Vector.Mutable.Linear.Internal

Methods

(<>) :: Vector a %1 -> Vector a %1 -> Vector a Source #

Semigroup a => Semigroup (IO a) Source # 
Instance details

Defined in System.IO.Linear

Methods

(<>) :: IO a %1 -> IO a %1 -> IO a Source #

Semigroup a => Semigroup (RIO a) Source # 
Instance details

Defined in System.IO.Resource.Linear.Internal

Methods

(<>) :: RIO a %1 -> RIO a %1 -> RIO a Source #

Semigroup a => Semigroup (Maybe a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Maybe a %1 -> Maybe a %1 -> Maybe a Source #

Semigroup a => Semigroup (Solo a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Solo a %1 -> Solo a %1 -> Solo a Source #

Semigroup [a] Source # 
Instance details

Defined in Data.List.Linear

Methods

(<>) :: [a] %1 -> [a] %1 -> [a] Source #

(Consumable a, Consumable b) => Semigroup (Either a b) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Either a b %1 -> Either a b %1 -> Either a b Source #

Semigroup (Proxy a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Proxy a %1 -> Proxy a %1 -> Proxy a Source #

Keyed k => Semigroup (HashMap k v) Source # 
Instance details

Defined in Data.HashMap.Mutable.Linear.Internal

Methods

(<>) :: HashMap k v %1 -> HashMap k v %1 -> HashMap k v Source #

(Semigroup a, Semigroup b) => Semigroup (a, b) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: (a, b) %1 -> (a, b) %1 -> (a, b) Source #

Semigroup a => Semigroup (Const a b) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Const a b %1 -> Const a b %1 -> Const a b Source #

(Applicative f, Semigroup a) => Semigroup (Ap f a) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

(<>) :: Ap f a %1 -> Ap f a %1 -> Ap f a Source #

(Semigroup a, Semigroup b, Semigroup c) => Semigroup (a, b, c) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: (a, b, c) %1 -> (a, b, c) %1 -> (a, b, c) Source #

(Semigroup (f a), Semigroup (g a)) => Semigroup (Product f g a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Product f g a %1 -> Product f g a %1 -> Product f g a Source #

(Semigroup a, Semigroup b, Semigroup c, Semigroup d) => Semigroup (a, b, c, d) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: (a, b, c, d) %1 -> (a, b, c, d) %1 -> (a, b, c, d) Source #

Semigroup (f (g a)) => Semigroup (Compose f g a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Compose f g a %1 -> Compose f g a %1 -> Compose f g a Source #

(Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e) => Semigroup (a, b, c, d, e) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: (a, b, c, d, e) %1 -> (a, b, c, d, e) %1 -> (a, b, c, d, e) Source #

newtype Last a #

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

Examples

Expand
>>> Last 0 <> Last 10
Last {getLast = 10}
>>> sconcat $ Last 1 :| [ Last n | n <- [2..]]
Last {getLast = * hangs forever *

Constructors

Last 

Fields

Instances

Instances details
Foldable1 Last

Since: base-4.18.0.0

Instance details

Defined in Data.Foldable1

Methods

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

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

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

toNonEmpty :: Last a -> NonEmpty a #

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

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

head :: Last a -> a #

last :: Last a -> a #

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

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

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

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

NFData1 Last

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

Applicative Last

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

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.9.0.0

Instance details

Defined in Data.Semigroup

Methods

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

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

Monad Last

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

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

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

return :: a -> Last a #

MonadFix Last

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

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

Foldable Last

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

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.9.0.0

Instance details

Defined in Data.Semigroup

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 Data.Semigroup

Associated Types

type Rep1 Last

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

type Rep1 Last = D1 ('MetaData "Last" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))

Methods

from1 :: Last a -> Rep1 Last a #

to1 :: Rep1 Last a -> Last a #

Unbox a => Vector Vector (Last a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicUnsafeFreeze :: Mutable Vector s (Last a) -> ST s (Vector (Last a))

basicUnsafeThaw :: Vector (Last a) -> ST s (Mutable Vector s (Last a))

basicLength :: Vector (Last a) -> Int

basicUnsafeSlice :: Int -> Int -> Vector (Last a) -> Vector (Last a)

basicUnsafeIndexM :: Vector (Last a) -> Int -> Box (Last a)

basicUnsafeCopy :: Mutable Vector s (Last a) -> Vector (Last a) -> ST s ()

elemseq :: Vector (Last a) -> Last a -> b -> b

Unbox a => MVector MVector (Last a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicLength :: MVector s (Last a) -> Int

basicUnsafeSlice :: Int -> Int -> MVector s (Last a) -> MVector s (Last a)

basicOverlaps :: MVector s (Last a) -> MVector s (Last a) -> Bool

basicUnsafeNew :: Int -> ST s (MVector s (Last a))

basicInitialize :: MVector s (Last a) -> ST s ()

basicUnsafeReplicate :: Int -> Last a -> ST s (MVector s (Last a))

basicUnsafeRead :: MVector s (Last a) -> Int -> ST s (Last a)

basicUnsafeWrite :: MVector s (Last a) -> Int -> Last a -> ST s ()

basicClear :: MVector s (Last a) -> ST s ()

basicSet :: MVector s (Last a) -> Last a -> ST s ()

basicUnsafeCopy :: MVector s (Last a) -> MVector s (Last a) -> ST s ()

basicUnsafeMove :: MVector s (Last a) -> MVector s (Last a) -> ST s ()

basicUnsafeGrow :: MVector s (Last a) -> Int -> ST s (MVector s (Last a))

NFData a => NFData (Last a)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Last a -> () #

Semigroup (Last a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

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

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

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

Data a => Data (Last a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Last a -> c (Last a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Last a) #

toConstr :: Last a -> Constr #

dataTypeOf :: Last a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Last a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Last a)) #

gmapT :: (forall b. Data b => b -> b) -> Last a -> Last a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Last a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Last a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Last a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Last a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Last a -> m (Last a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Last a -> m (Last a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Last a -> m (Last a) #

Bounded a => Bounded (Last a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

minBound :: Last a #

maxBound :: Last a #

Enum a => Enum (Last a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

succ :: Last a -> Last a #

pred :: Last a -> Last a #

toEnum :: Int -> Last a #

fromEnum :: Last a -> Int #

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

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

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

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

Generic (Last a) 
Instance details

Defined in Data.Semigroup

Associated Types

type Rep (Last a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

type Rep (Last a) = D1 ('MetaData "Last" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

Methods

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

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

Read a => Read (Last a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Show a => Show (Last a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

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

show :: Last a -> String #

showList :: [Last a] -> ShowS #

Eq a => Eq (Last a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

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

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

Ord a => Ord (Last a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

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 #

Hashable a => Hashable (Last a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Last a -> Int #

hash :: Last a -> Int #

Consumable a => Semigroup (Last a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Last a %1 -> Last a %1 -> Last a Source #

Consumable a => Consumable (Last a) Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Consumable

Methods

consume :: Last a %1 -> () Source #

Prim a => Prim (Last a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Unbox a => Unbox (Last a) 
Instance details

Defined in Data.Vector.Unboxed.Base

type Rep1 Last

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

type Rep1 Last = D1 ('MetaData "Last" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
type Rep1 Last 
Instance details

Defined in Generics.Linear.Instances.Base

type Rep1 Last = D1 ('MetaData "Last" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
newtype MVector s (Last a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s (Last a) = MV_Last (MVector s a)
type Rep (Last a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

type Rep (Last a) = D1 ('MetaData "Last" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type Rep (Last a) 
Instance details

Defined in Generics.Linear.Instances.Base

type Rep (Last a) = D1 ('MetaData "Last" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
newtype Vector (Last a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype Vector (Last a) = V_Last (Vector 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 #

NFData1 Product

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a -> ()) -> 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 #

Unbox a => Vector Vector (Product a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicUnsafeFreeze :: Mutable Vector s (Product a) -> ST s (Vector (Product a))

basicUnsafeThaw :: Vector (Product a) -> ST s (Mutable Vector s (Product a))

basicLength :: Vector (Product a) -> Int

basicUnsafeSlice :: Int -> Int -> Vector (Product a) -> Vector (Product a)

basicUnsafeIndexM :: Vector (Product a) -> Int -> Box (Product a)

basicUnsafeCopy :: Mutable Vector s (Product a) -> Vector (Product a) -> ST s ()

elemseq :: Vector (Product a) -> Product a -> b -> b

Unbox a => MVector MVector (Product a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicLength :: MVector s (Product a) -> Int

basicUnsafeSlice :: Int -> Int -> MVector s (Product a) -> MVector s (Product a)

basicOverlaps :: MVector s (Product a) -> MVector s (Product a) -> Bool

basicUnsafeNew :: Int -> ST s (MVector s (Product a))

basicInitialize :: MVector s (Product a) -> ST s ()

basicUnsafeReplicate :: Int -> Product a -> ST s (MVector s (Product a))

basicUnsafeRead :: MVector s (Product a) -> Int -> ST s (Product a)

basicUnsafeWrite :: MVector s (Product a) -> Int -> Product a -> ST s ()

basicClear :: MVector s (Product a) -> ST s ()

basicSet :: MVector s (Product a) -> Product a -> ST s ()

basicUnsafeCopy :: MVector s (Product a) -> MVector s (Product a) -> ST s ()

basicUnsafeMove :: MVector s (Product a) -> MVector s (Product a) -> ST s ()

basicUnsafeGrow :: MVector s (Product a) -> Int -> ST s (MVector s (Product a))

NFData a => NFData (Product a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Product 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 => 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 #

MultIdentity a => Monoid (Product a) Source # 
Instance details

Defined in Data.Num.Linear

Methods

mempty :: Product a Source #

Multiplicative a => Semigroup (Product a) Source # 
Instance details

Defined in Data.Num.Linear

Methods

(<>) :: Product a %1 -> Product a %1 -> Product a Source #

Consumable a => Consumable (Product a) Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Consumable

Methods

consume :: Product a %1 -> () Source #

Dupable a => Dupable (Product a) Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Dupable

Methods

dupR :: Product a %1 -> Replicator (Product a) Source #

dup2 :: Product a %1 -> (Product a, Product a) Source #

Movable a => Movable (Product a) Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Movable

Methods

move :: Product a %1 -> Ur (Product a) Source #

Prim a => Prim (Product a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Unbox a => Unbox (Product a) 
Instance details

Defined in Data.Vector.Unboxed.Base

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 Rep1 Product 
Instance details

Defined in Generics.Linear.Instances.Base

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))
newtype MVector s (Product a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s (Product a) = MV_Product (MVector s a)
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)))
type Rep (Product a) 
Instance details

Defined in Generics.Linear.Instances.Base

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 Vector (Product a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype Vector (Product a) = V_Product (Vector 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 #

NFData1 Sum

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a -> ()) -> 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 #

Unbox a => Vector Vector (Sum a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicUnsafeFreeze :: Mutable Vector s (Sum a) -> ST s (Vector (Sum a))

basicUnsafeThaw :: Vector (Sum a) -> ST s (Mutable Vector s (Sum a))

basicLength :: Vector (Sum a) -> Int

basicUnsafeSlice :: Int -> Int -> Vector (Sum a) -> Vector (Sum a)

basicUnsafeIndexM :: Vector (Sum a) -> Int -> Box (Sum a)

basicUnsafeCopy :: Mutable Vector s (Sum a) -> Vector (Sum a) -> ST s ()

elemseq :: Vector (Sum a) -> Sum a -> b -> b

Unbox a => MVector MVector (Sum a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicLength :: MVector s (Sum a) -> Int

basicUnsafeSlice :: Int -> Int -> MVector s (Sum a) -> MVector s (Sum a)

basicOverlaps :: MVector s (Sum a) -> MVector s (Sum a) -> Bool

basicUnsafeNew :: Int -> ST s (MVector s (Sum a))

basicInitialize :: MVector s (Sum a) -> ST s ()

basicUnsafeReplicate :: Int -> Sum a -> ST s (MVector s (Sum a))

basicUnsafeRead :: MVector s (Sum a) -> Int -> ST s (Sum a)

basicUnsafeWrite :: MVector s (Sum a) -> Int -> Sum a -> ST s ()

basicClear :: MVector s (Sum a) -> ST s ()

basicSet :: MVector s (Sum a) -> Sum a -> ST s ()

basicUnsafeCopy :: MVector s (Sum a) -> MVector s (Sum a) -> ST s ()

basicUnsafeMove :: MVector s (Sum a) -> MVector s (Sum a) -> ST s ()

basicUnsafeGrow :: MVector s (Sum a) -> Int -> ST s (MVector s (Sum a))

NFData a => NFData (Sum a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Sum 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 #

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 #

AddIdentity a => Monoid (Sum a) Source # 
Instance details

Defined in Data.Num.Linear

Methods

mempty :: Sum a Source #

Additive a => Semigroup (Sum a) Source # 
Instance details

Defined in Data.Num.Linear

Methods

(<>) :: Sum a %1 -> Sum a %1 -> Sum a Source #

Consumable a => Consumable (Sum a) Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Consumable

Methods

consume :: Sum a %1 -> () Source #

Dupable a => Dupable (Sum a) Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Dupable

Methods

dupR :: Sum a %1 -> Replicator (Sum a) Source #

dup2 :: Sum a %1 -> (Sum a, Sum a) Source #

Movable a => Movable (Sum a) Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Movable

Methods

move :: Sum a %1 -> Ur (Sum a) Source #

Prim a => Prim (Sum a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Unbox a => Unbox (Sum a) 
Instance details

Defined in Data.Vector.Unboxed.Base

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 Rep1 Sum 
Instance details

Defined in Generics.Linear.Instances.Base

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))
newtype MVector s (Sum a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s (Sum a) = MV_Sum (MVector s a)
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)))
type Rep (Sum a) 
Instance details

Defined in Generics.Linear.Instances.Base

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 Vector (Sum a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype Vector (Sum a) = V_Sum (Vector 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
NFData All

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: All -> () #

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 #

Monoid All Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: All Source #

Semigroup All Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: All %1 -> All %1 -> All Source #

Consumable All Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Consumable

Methods

consume :: All %1 -> () Source #

Dupable All Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Dupable

Methods

dupR :: All %1 -> Replicator All Source #

dup2 :: All %1 -> (All, All) Source #

Movable All Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Movable

Methods

move :: All %1 -> Ur All Source #

Unbox All 
Instance details

Defined in Data.Vector.Unboxed.Base

Vector Vector All 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicUnsafeFreeze :: Mutable Vector s All -> ST s (Vector All)

basicUnsafeThaw :: Vector All -> ST s (Mutable Vector s All)

basicLength :: Vector All -> Int

basicUnsafeSlice :: Int -> Int -> Vector All -> Vector All

basicUnsafeIndexM :: Vector All -> Int -> Box All

basicUnsafeCopy :: Mutable Vector s All -> Vector All -> ST s ()

elemseq :: Vector All -> All -> b -> b

MVector MVector All 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicLength :: MVector s All -> Int

basicUnsafeSlice :: Int -> Int -> MVector s All -> MVector s All

basicOverlaps :: MVector s All -> MVector s All -> Bool

basicUnsafeNew :: Int -> ST s (MVector s All)

basicInitialize :: MVector s All -> ST s ()

basicUnsafeReplicate :: Int -> All -> ST s (MVector s All)

basicUnsafeRead :: MVector s All -> Int -> ST s All

basicUnsafeWrite :: MVector s All -> Int -> All -> ST s ()

basicClear :: MVector s All -> ST s ()

basicSet :: MVector s All -> All -> ST s ()

basicUnsafeCopy :: MVector s All -> MVector s All -> ST s ()

basicUnsafeMove :: MVector s All -> MVector s All -> ST s ()

basicUnsafeGrow :: MVector s All -> Int -> ST s (MVector s 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)))
type Rep All 
Instance details

Defined in Generics.Linear.Instances.Base

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 Vector All 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype Vector All = V_All (Vector Bool)
newtype MVector s All 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s All = MV_All (MVector s Bool)

newtype Endo a Source #

An Endo a is just a linear function of type a %1-> a. This has a classic monoid definition with id and (.).

Constructors

Endo (a %1 -> a) 

Instances

Instances details
Monoid (Endo a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Endo a #

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

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

Semigroup (Endo a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

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

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

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

Monoid (Endo a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Endo a Source #

Semigroup (Endo a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Endo a %1 -> Endo a %1 -> Endo a Source #

appEndo :: Endo a %1 -> a %1 -> a Source #

A linear application of an Endo.

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 #

NFData1 Dual

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a -> ()) -> 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 #

Unbox a => Vector Vector (Dual a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicUnsafeFreeze :: Mutable Vector s (Dual a) -> ST s (Vector (Dual a))

basicUnsafeThaw :: Vector (Dual a) -> ST s (Mutable Vector s (Dual a))

basicLength :: Vector (Dual a) -> Int

basicUnsafeSlice :: Int -> Int -> Vector (Dual a) -> Vector (Dual a)

basicUnsafeIndexM :: Vector (Dual a) -> Int -> Box (Dual a)

basicUnsafeCopy :: Mutable Vector s (Dual a) -> Vector (Dual a) -> ST s ()

elemseq :: Vector (Dual a) -> Dual a -> b -> b

Unbox a => MVector MVector (Dual a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicLength :: MVector s (Dual a) -> Int

basicUnsafeSlice :: Int -> Int -> MVector s (Dual a) -> MVector s (Dual a)

basicOverlaps :: MVector s (Dual a) -> MVector s (Dual a) -> Bool

basicUnsafeNew :: Int -> ST s (MVector s (Dual a))

basicInitialize :: MVector s (Dual a) -> ST s ()

basicUnsafeReplicate :: Int -> Dual a -> ST s (MVector s (Dual a))

basicUnsafeRead :: MVector s (Dual a) -> Int -> ST s (Dual a)

basicUnsafeWrite :: MVector s (Dual a) -> Int -> Dual a -> ST s ()

basicClear :: MVector s (Dual a) -> ST s ()

basicSet :: MVector s (Dual a) -> Dual a -> ST s ()

basicUnsafeCopy :: MVector s (Dual a) -> MVector s (Dual a) -> ST s ()

basicUnsafeMove :: MVector s (Dual a) -> MVector s (Dual a) -> ST s ()

basicUnsafeGrow :: MVector s (Dual a) -> Int -> ST s (MVector s (Dual a))

NFData a => NFData (Dual a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Dual 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 #

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 #

Monoid a => Monoid (Dual a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Dual a Source #

Semigroup a => Semigroup (Dual a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Dual a %1 -> Dual a %1 -> Dual a Source #

Consumable a => Consumable (Dual a) Source # 
Instance details

Defined in Data.Unrestricted.Linear.Internal.Consumable

Methods

consume :: Dual a %1 -> () Source #

Prim a => Prim (Dual a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Unbox a => Unbox (Dual a) 
Instance details

Defined in Data.Vector.Unboxed.Base

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 Rep1 Dual 
Instance details

Defined in Generics.Linear.Instances.Base

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))
newtype MVector s (Dual a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s (Dual a) = MV_Dual (MVector s a)
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)))
type Rep (Dual a) 
Instance details

Defined in Generics.Linear.Instances.Base

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 Vector (Dual a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype Vector (Dual a) = V_Dual (Vector a)

newtype NonLinear a Source #

DerivingVia combinator for Semigroup (resp. Monoid) given linear Semigroup (resp. Monoid).

newtype Endo a = Endo (a %1-> a)
  deriving (Prelude.Semigroup) via NonLinear (Endo a)

Constructors

NonLinear a 

Instances

Instances details
(Semigroup a, Monoid a) => Monoid (NonLinear a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Semigroup a => Semigroup (NonLinear a) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

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

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

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