| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Optics.IxSetter
Description
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 :: forall k (is :: IxList) i s t a b. (Is k A_Setter, HasSingleIndex is 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 :: forall k (is :: IxList) i s t a b. (Is k A_Setter, HasSingleIndex is i) => Optic k is s t a b -> (i -> b) -> s -> t
- iset' :: forall k (is :: IxList) i s t a b. (Is k A_Setter, HasSingleIndex is i) => Optic k is s t a b -> (i -> b) -> s -> t
- iover' :: forall k (is :: IxList) i s t a b. (Is k A_Setter, HasSingleIndex is i) => Optic k is s t a b -> (i -> a -> b) -> s -> t
- data A_Setter
- 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 :: forall k (is :: IxList) i s t a b. (Is k A_Setter, HasSingleIndex is 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.
ioverimapped≡imap
Additional elimination forms
iset :: forall k (is :: IxList) i s t a b. (Is k A_Setter, HasSingleIndex is i) => Optic k is s t a b -> (i -> b) -> s -> t Source #
iset' :: forall k (is :: IxList) i s t a b. (Is k A_Setter, HasSingleIndex is i) => Optic k is s t a b -> (i -> b) -> s -> t Source #
Apply an indexed setter, strictly.
iover' :: forall k (is :: IxList) i s t a b. (Is k A_Setter, HasSingleIndex is i) => Optic k is s t a b -> (i -> a -> b) -> s -> t Source #
Apply an indexed setter as a modifier, strictly.
Subtyping
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:
imapf.imapg ≡imap(\i -> f i.g i)imap(\_ a -> a) ≡id
Minimal complete definition
Nothing
Methods
imap :: (i -> a -> b) -> f a -> f b Source #
Map with access to the index.
default imap :: TraversableWithIndex i f => (i -> a -> b) -> f a -> f b Source #
Instances
| FunctorWithIndex () Identity | |
| FunctorWithIndex () Par1 | |
| FunctorWithIndex () Maybe | |
| FunctorWithIndex Int IntMap | |
| FunctorWithIndex Int Seq | The position in the |
| FunctorWithIndex Int NonEmpty | |
| FunctorWithIndex Int ZipList | Same instance as for |
| FunctorWithIndex Int [] | The position in the list is available as the index. |
| FunctorWithIndex Void (Proxy :: Type -> Type) | |
| FunctorWithIndex Void (U1 :: Type -> Type) | |
| FunctorWithIndex Void (V1 :: Type -> Type) | |
| Ix i => FunctorWithIndex i (Array i) | |
| FunctorWithIndex k (Map k) | |
| FunctorWithIndex k ((,) k) | |
| FunctorWithIndex Void (Const e :: Type -> Type) | |
| FunctorWithIndex Void (Constant e :: Type -> Type) | |
| FunctorWithIndex i f => FunctorWithIndex i (Rec1 f) | |
| FunctorWithIndex i f => FunctorWithIndex i (Backwards f) | |
| FunctorWithIndex i m => FunctorWithIndex i (IdentityT m) | |
| FunctorWithIndex i f => FunctorWithIndex i (Reverse f) | |
| FunctorWithIndex Void (K1 i c :: Type -> Type) | |
| FunctorWithIndex r ((->) r) | |
| FunctorWithIndex [Int] Tree | |
| FunctorWithIndex i m => FunctorWithIndex (e, i) (ReaderT e m) | |
| (FunctorWithIndex i f, FunctorWithIndex j g) => FunctorWithIndex (Either i j) (Product f g) | |
| (FunctorWithIndex i f, FunctorWithIndex j g) => FunctorWithIndex (Either i j) (Sum f g) | |
| (FunctorWithIndex i f, FunctorWithIndex j g) => FunctorWithIndex (Either i j) (f :*: g) | |
| (FunctorWithIndex i f, FunctorWithIndex j g) => FunctorWithIndex (Either i j) (f :+: g) | |
| (FunctorWithIndex i f, FunctorWithIndex j g) => FunctorWithIndex (i, j) (Compose f g) | |
| (FunctorWithIndex i f, FunctorWithIndex j g) => FunctorWithIndex (i, j) (f :.: g) | |