Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type IxSetter i s t a b = Optic A_Setter ( WithIx i) s t a b
- type IxSetter' i s a = Optic' A_Setter ( WithIx i) s a
- isets :: ((i -> a -> b) -> s -> t) -> IxSetter i s t a b
- iover :: ( Is k A_Setter , is `HasSingleIndex` i) => Optic k is s t a b -> (i -> a -> b) -> s -> t
- imapped :: FunctorWithIndex i f => IxSetter i (f a) (f b) a b
- iset :: ( Is k A_Setter , is `HasSingleIndex` i) => Optic k is s t a b -> (i -> b) -> s -> t
- iset' :: ( Is k A_Setter , is `HasSingleIndex` i) => Optic k is s t a b -> (i -> b) -> s -> t
- iover' :: ( Is k A_Setter , is `HasSingleIndex` i) => Optic k is s t a b -> (i -> a -> b) -> s -> t
- data A_Setter :: OpticKind
-
class
Functor
f =>
FunctorWithIndex
i (f ::
Type
->
Type
) | f -> i
where
- imap :: (i -> a -> b) -> f a -> f b
Formation
type IxSetter i s t a b = Optic A_Setter ( WithIx i) s t a b Source #
Type synonym for a type-modifying indexed setter.
type IxSetter' i s a = Optic' A_Setter ( WithIx i) s a Source #
Type synonym for a type-preserving indexed setter.
Introduction
isets :: ((i -> a -> b) -> s -> t) -> IxSetter i s t a b Source #
Build an indexed setter from a function to modify the element(s).
Elimination
iover :: ( Is k A_Setter , is `HasSingleIndex` i) => Optic k is s t a b -> (i -> a -> b) -> s -> t Source #
Apply an indexed setter as a modifier.
Computation
Well-formedness
Additional introduction forms
imapped :: FunctorWithIndex i f => IxSetter i (f a) (f b) a b Source #
Indexed setter via the
FunctorWithIndex
class.
iover
imapped
≡imap
Additional elimination forms
iset :: ( Is k A_Setter , is `HasSingleIndex` i) => Optic k is s t a b -> (i -> b) -> s -> t Source #
iset' :: ( Is k A_Setter , is `HasSingleIndex` i) => Optic k is s t a b -> (i -> b) -> s -> t Source #
Apply an indexed setter, strictly.
iover' :: ( Is k A_Setter , is `HasSingleIndex` i) => Optic k is s t a b -> (i -> a -> b) -> s -> t Source #
Apply an indexed setter as a modifier, strictly.
Subtyping
data A_Setter :: OpticKind Source #
Tag for a setter.
Instances
Re-exports
class Functor f => FunctorWithIndex i (f :: Type -> Type ) | f -> i where Source #
A
Functor
with an additional index.
Instances must satisfy a modified form of the
Functor
laws:
imap
f.
imap
g ≡imap
(\i -> f i.
g i)imap
(\_ a -> a) ≡id
Nothing