lens-4.12.3: Lenses, Folds and Traversals

Copyright(C) 2012-2015 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell98

Control.Lens.Internal.Fold

Contents

Description

 

Synopsis

Monoids for folding

newtype Folding f a Source

Constructors

Folding 

Fields

Instances

(Contravariant f, Applicative f) => Monoid (Folding f a) Source 

Methods

mempty :: Folding f a

mappend :: Folding f a -> Folding f a -> Folding f a

mconcat :: [Folding f a] -> Folding f a

(Contravariant f, Apply f) => Semigroup (Folding f a) Source 

Methods

(<>) :: Folding f a -> Folding f a -> Folding f a

sconcat :: NonEmpty (Folding f a) -> Folding f a

times1p :: Natural -> Folding f a -> Folding f a

newtype Traversed a f Source

Used internally by traverseOf_ and the like.

The argument a of the result should not be used!

Constructors

Traversed 

Fields

Instances

Applicative f => Monoid (Traversed a f) Source 

Methods

mempty :: Traversed a f

mappend :: Traversed a f -> Traversed a f -> Traversed a f

mconcat :: [Traversed a f] -> Traversed a f

Apply f => Semigroup (Traversed a f) Source 

Methods

(<>) :: Traversed a f -> Traversed a f -> Traversed a f

sconcat :: NonEmpty (Traversed a f) -> Traversed a f

times1p :: Natural -> Traversed a f -> Traversed a f

newtype Sequenced a m Source

Used internally by mapM_ and the like.

The argument a of the result should not be used!

Constructors

Sequenced 

Fields

Instances

Monad m => Monoid (Sequenced a m) Source 

Methods

mempty :: Sequenced a m

mappend :: Sequenced a m -> Sequenced a m -> Sequenced a m

mconcat :: [Sequenced a m] -> Sequenced a m

Apply m => Semigroup (Sequenced a m) Source 

Methods

(<>) :: Sequenced a m -> Sequenced a m -> Sequenced a m

sconcat :: NonEmpty (Sequenced a m) -> Sequenced a m

times1p :: Natural -> Sequenced a m -> Sequenced a m

data Max a Source

Used for maximumOf.

Constructors

NoMax 
Max a 

Instances

Ord a => Monoid (Max a) Source 

Methods

mempty :: Max a

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

mconcat :: [Max a] -> Max a

Ord a => Semigroup (Max a) Source 

Methods

(<>) :: Max a -> Max a -> Max a

sconcat :: NonEmpty (Max a) -> Max a

times1p :: Natural -> Max a -> Max a

getMax :: Max a -> Maybe a Source

Obtain the maximum.

data Min a Source

Used for minimumOf.

Constructors

NoMin 
Min a 

Instances

Ord a => Monoid (Min a) Source 

Methods

mempty :: Min a

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

mconcat :: [Min a] -> Min a

Ord a => Semigroup (Min a) Source 

Methods

(<>) :: Min a -> Min a -> Min a

sconcat :: NonEmpty (Min a) -> Min a

times1p :: Natural -> Min a -> Min a

getMin :: Min a -> Maybe a Source

Obtain the minimum.

data Leftmost a Source

Used for preview.

Constructors

LPure 
LLeaf a 
LStep (Leftmost a) 

getLeftmost :: Leftmost a -> Maybe a Source

Extract the Leftmost element. This will fairly eagerly determine that it can return Just the moment it sees any element at all.

getRightmost :: Rightmost a -> Maybe a Source

Extract the Rightmost element. This will fairly eagerly determine that it can return Just the moment it sees any element at all.

data ReifiedMonoid a Source

Constructors

ReifiedMonoid 

Fields

newtype M a s Source

Constructors

M a 

Instances

Reifies * s (ReifiedMonoid a) => Monoid (M a s) Source 

Methods

mempty :: M a s

mappend :: M a s -> M a s -> M a s

mconcat :: [M a s] -> M a s

reifyFold :: (a -> a -> a) -> a -> (forall s. Reifies s (ReifiedMonoid a) => t -> M a s) -> t -> a Source