fresnel-0.1.0.1: high-powered optics in a small package
Safe HaskellNone
LanguageHaskell2010

Fresnel.Fold

Synopsis

Folds

type Fold s a = forall (p :: Type -> Type -> Type). IsFold p => Optic' p s a Source #

class (IsOptionalFold p, IsFold1 p, IsTraversal p) => IsFold (p :: Type -> Type -> Type) Source #

Instances

Instances details
Monoid r => IsFold (Forget r :: Type -> Type -> Type) Source # 
Instance details

Defined in Fresnel.Fold

(Applicative f, Traversable f, Contravariant f) => IsFold (Star f) Source # 
Instance details

Defined in Fresnel.Fold

Construction

folded :: forall (f :: Type -> Type) a. Foldable f => Fold (f a) a Source #

unfolded :: (s -> Maybe (a, s)) -> Fold s a Source #

folding :: Foldable f => (s -> f a) -> Fold s a Source #

foldring :: (forall (f :: Type -> Type). Applicative f => (a -> f u -> f u) -> f v -> s -> f w) -> Fold s a Source #

foldMapping :: (forall m. Monoid m => (a -> m) -> s -> m) -> Fold s a Source #

Make a Fold by lifting a foldMap-like function.

foldMapping foldMap = folded

foldMap1ing :: (forall m. Semigroup m => (a -> m) -> s -> m) -> Fold s a Source #

Make a Fold by lifting a foldMap1-like function.

ignored :: forall s a b p. IsTraversal p => Optic p s s a b Source #

The trivially empty Traversal.

traverseOf ignored f = pure

backwards :: Fold s a -> Fold s a Source #

iterated :: (a -> a) -> Fold a a Source #

filtered :: (a -> Bool) -> Fold a a Source #

repeated :: forall a p. IsFold p => Optic' p a a Source #

An infinite fold repeatedly producing its input.

toListOf repeated a = repeat a

replicated :: Int -> Fold a a Source #

A fold producing its input a finite number of times.

toListOf (replicated n) a = replicate n a

cycled :: Fold s a -> Fold s a Source #

takingWhile :: (a -> Bool) -> Fold s a -> Fold s a Source #

Elimination

has :: Fold s a -> s -> Bool Source #

hasn't :: Fold s a -> s -> Bool Source #

foldMapOf :: Monoid m => Fold s a -> (a -> m) -> s -> m Source #

foldMapByOf :: Fold s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r Source #

foldrOf :: Fold s a -> (a -> r -> r) -> r -> s -> r Source #

foldlOf' :: Fold s a -> (r -> a -> r) -> r -> s -> r Source #

foldOf :: Monoid a => Fold s a -> s -> a Source #

foldByOf :: Fold s a -> (a -> a -> a) -> a -> s -> a Source #

sequenceOf_ :: Applicative f => Fold s (f a) -> s -> f () Source #

traverseOf_ :: Applicative f => Fold s a -> (a -> f r) -> s -> f () Source #

forOf_ :: Applicative f => Fold s a -> s -> (a -> f r) -> f () Source #

toListOf :: Fold s a -> s -> [a] Source #

anyOf :: Fold s a -> (a -> Bool) -> s -> Bool Source #

allOf :: Fold s a -> (a -> Bool) -> s -> Bool Source #

noneOf :: Fold s a -> (a -> Bool) -> s -> Bool Source #

andOf :: Fold s Bool -> s -> Bool Source #

orOf :: Fold s Bool -> s -> Bool Source #

productOf :: Num a => Fold s a -> s -> a Source #

sumOf :: Num a => Fold s a -> s -> a Source #

altOf :: Alternative f => Fold s a -> s -> f a Source #

asumOf :: Alternative f => Fold s (f a) -> s -> f a Source #

concatOf :: Fold s [a] -> s -> [a] Source #

concatMapOf :: Fold s a -> (a -> [r]) -> s -> [r] Source #

elemOf :: Eq a => Fold s a -> a -> s -> Bool Source #

notElemOf :: Eq a => Fold s a -> a -> s -> Bool Source #

lengthOf :: Fold s a -> s -> Int Source #

nullOf :: Fold s a -> s -> Bool Source #

notNullOf :: Fold s a -> s -> Bool Source #

firstOf :: Fold s a -> s -> Maybe a Source #

lastOf :: Fold s a -> s -> Maybe a Source #

minimumOf :: Ord a => Fold s a -> s -> Maybe a Source #

minimumByOf :: Fold s a -> (a -> a -> Ordering) -> s -> Maybe a Source #

maximumOf :: Ord a => Fold s a -> s -> Maybe a Source #

maximumByOf :: Fold s a -> (a -> a -> Ordering) -> s -> Maybe a Source #

findOf :: Fold s a -> (a -> Bool) -> s -> Maybe a Source #

findMOf :: Monad m => Fold s a -> (a -> m Bool) -> s -> m (Maybe a) Source #

lookupOf :: Eq k => Fold s (k, v) -> k -> s -> Maybe v Source #

previews :: Fold s a -> (a -> r) -> s -> Maybe r Source #

preview :: Fold s a -> s -> Maybe a Source #

(^?) :: s -> Fold s a -> Maybe a infixl 8 Source #

newtype Failover s a Source #

Constructors

Failover 

Fields

Instances

Instances details
Monoid (Failover s a) Source # 
Instance details

Defined in Fresnel.Fold

Methods

mempty :: Failover s a #

mappend :: Failover s a -> Failover s a -> Failover s a #

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

Semigroup (Failover s a) Source # 
Instance details

Defined in Fresnel.Fold

Methods

(<>) :: Failover s a -> Failover s a -> Failover s a #

sconcat :: NonEmpty (Failover s a) -> Failover s a #

stimes :: Integral b => b -> Failover s a -> Failover s a #

newtype Union s a Source #

Constructors

Union 

Fields

Instances

Instances details
Monoid (Union s a) Source # 
Instance details

Defined in Fresnel.Fold

Methods

mempty :: Union s a #

mappend :: Union s a -> Union s a -> Union s a #

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

Semigroup (Union s a) Source # 
Instance details

Defined in Fresnel.Fold

Methods

(<>) :: Union s a -> Union s a -> Union s a #

sconcat :: NonEmpty (Union s a) -> Union s a #

stimes :: Integral b => b -> Union s a -> Union s a #