optics-core-0.4.1.1: Optics as an abstract interface: core definitions

Safe Haskell | None
Language | Haskell2010

Optics.Internal.Fold

Description

Internal implementation details of folds.

This module is intended for internal use only, and may change without warning in subsequent releases.

Synopsis

- foldVL__ :: (Bicontravariant p, Traversing p) => (forall (f :: Type -> Type). Applicative f => (a -> f u) -> s -> f v) -> Optic__ p i i s t a b
- folded__ :: (Bicontravariant p, Traversing p, Foldable f) => Optic__ p i i (f a) (f b) a b
- foldring__ :: (Bicontravariant p, Traversing p) => (forall (f :: Type -> Type). Applicative f => (a -> f u -> f u) -> f v -> s -> f w) -> Optic__ p i i s t a b
- data Leftmost a
  - = LPure
  - | LLeaf a
  - | LStep (Leftmost a)
- getLeftmost :: Leftmost a -> Maybe a
- data Rightmost a
  - = RPure
  - | RLeaf a
  - | RStep (Rightmost a)
- getRightmost :: Rightmost a -> Maybe a

# Documentation

foldVL__ :: (Bicontravariant p, Traversing p) => (forall (f :: Type -> Type). Applicative f => (a -> f u) -> s -> f v) -> Optic__ p i i s t a b Source #

Internal implementation of `foldVL`.

folded__ :: (Bicontravariant p, Traversing p, Foldable f) => Optic__ p i i (f a) (f b) a b Source #

Internal implementation of `folded`.

foldring__ :: (Bicontravariant p, Traversing p) => (forall (f :: Type -> Type). Applicative f => (a -> f u -> f u) -> f v -> s -> f w) -> Optic__ p i i s t a b Source #

Internal implementation of `foldring`.

data Leftmost a Source #

Used for `headOf` and `iheadOf`.

Constructors

LPure |
LLeaf a |
LStep (Leftmost a) |

#### Instances

Instances details

Monoid (Leftmost a) Source # |
Instance details Defined in Optics.Internal.Fold Methods mempty :: Leftmost a Source # mappend :: Leftmost a -> Leftmost a -> Leftmost a Source # mconcat :: [Leftmost a] -> Leftmost a Source #
Semigroup (Leftmost a) Source # |
Instance details Defined in Optics.Internal.Fold Methods (<>) :: Leftmost a -> Leftmost a -> Leftmost a Source # sconcat :: NonEmpty (Leftmost a) -> Leftmost a Source # stimes :: Integral b => b -> Leftmost a -> Leftmost a Source #

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.

data Rightmost a Source #

Used for `lastOf` and `ilastOf`.

Constructors

RPure |
RLeaf a |
RStep (Rightmost a) |

#### Instances

Instances details

Monoid (Rightmost a) Source # |
Instance details Defined in Optics.Internal.Fold Methods mempty :: Rightmost a Source # mappend :: Rightmost a -> Rightmost a -> Rightmost a Source # mconcat :: [Rightmost a] -> Rightmost a Source #
Semigroup (Rightmost a) Source # |
Instance details Defined in Optics.Internal.Fold Methods (<>) :: Rightmost a -> Rightmost a -> Rightmost a Source # sconcat :: NonEmpty (Rightmost a) -> Rightmost a Source # stimes :: Integral b => b -> Rightmost a -> Rightmost a Source #

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.