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

Fresnel.Fold1

Synopsis

Relevant folds

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

class (IsGetter p, IsTraversal1 p) => IsFold1 (p :: Type -> Type -> Type) Source #

Instances

Instances details
(Contravariant f, Apply f, Traversable f) => IsFold1 (OptionalStar f) Source # 
Instance details

Defined in Fresnel.Fold1.Internal

(Contravariant f, Apply f, Traversable f) => IsFold1 (Star1 f) Source # 
Instance details

Defined in Fresnel.Fold1.Internal

Semigroup r => IsFold1 (Forget r :: Type -> Type -> Type) Source # 
Instance details

Defined in Fresnel.Fold1.Internal

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

Defined in Fresnel.Fold1.Internal

Construction

folded1 :: forall (t :: Type -> Type) a. Foldable1 t => Fold1 (t a) a Source #

unfolded1 :: (s -> (a, Maybe s)) -> Fold1 s a Source #

fold1ing :: Foldable1 t => (s -> t a) -> Fold1 s a Source #

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

Make a Fold1 by lifting a foldMap1-like function.

foldMap1ing foldMap1 = folded1
foldMap1Of . foldMap1ing = id

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

Reverse the order in which a (finite) Fold1 is traversed.

backwards . backwards = id

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

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

An infinite fold repeatedly producing its input.

toListOf repeated a = repeat a

Elimination

foldMap1Of :: Semigroup m => Fold1 s a -> (a -> m) -> s -> m Source #

foldMap1ByOf :: Fold1 s a -> (r -> r -> r) -> (a -> r) -> s -> r Source #

foldrMap1Of :: Fold1 s a -> (a -> r) -> (a -> r -> r) -> s -> r Source #

foldlMap1Of :: Fold1 s a -> (a -> r) -> (r -> a -> r) -> s -> r Source #

fold1Of :: Semigroup a => Fold1 s a -> s -> a Source #

fold1ByOf :: Fold1 s a -> (a -> a -> a) -> s -> a Source #

sequence1Of_ :: Apply f => Fold1 s (f a) -> s -> f () Source #

traverse1Of_ :: Apply f => Fold1 s a -> (a -> f r) -> s -> f () Source #

for1Of_ :: Apply f => Fold1 s a -> s -> (a -> f r) -> f () Source #

toList1Of :: Fold1 s a -> s -> NonEmpty a Source #

concatOf :: Fold1 s (NonEmpty a) -> s -> NonEmpty a Source #

concatMapOf :: Fold1 s a -> (a -> NonEmpty r) -> s -> NonEmpty r Source #

firstOf :: Fold1 s a -> s -> a Source #

lastOf :: Fold1 s a -> s -> a Source #

minimumOf :: Ord a => Fold1 s a -> s -> a Source #

minimumByOf :: Fold1 s a -> (a -> a -> Ordering) -> s -> a Source #

maximumOf :: Ord a => Fold1 s a -> s -> a Source #

maximumByOf :: Fold1 s a -> (a -> a -> Ordering) -> s -> a Source #

Union semigroup

newtype Union s a Source #

Constructors

Union 

Fields

Instances

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

Defined in Fresnel.Fold1

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 #