| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Optics.Indexed
Description
This module defines general functionality for indexed optics. See the
"Indexed optics" section of the overview documentation in the Optics module
of the main optics package for more details.
Unlike Optics.Indexed.Core, this includes the definitions from modules for
specific indexed optic flavours such as Optics.IxTraversal, and includes
additional instances for FunctorWithIndex and similar classes.
Synopsis
- class IxOptic k s t a b where
- noIx :: forall (is :: IxList). NonEmptyIndices is => Optic k is s t a b -> Optic k NoIx s t a b
- conjoined :: forall (is :: IxList) i k s t a b. HasSingleIndex is i => Optic k NoIx s t a b -> Optic k is s t a b -> Optic k is s t a b
- (<%>) :: forall m k l s t a b (is :: IxList) i (js :: IxList) j u v. (m ~ Join k l, Is k m, Is l m, IxOptic m s t a b, HasSingleIndex is i, HasSingleIndex js j) => Optic k is s t u v -> Optic l js u v a b -> Optic m (WithIx (i, j)) s t a b
- (%>) :: forall m k l s t u v (is :: IxList) (js :: IxList) a b. (m ~ Join k l, Is k m, Is l m, IxOptic k s t u v, NonEmptyIndices is) => Optic k is s t u v -> Optic l js u v a b -> Optic m js s t a b
- (<%) :: forall m k l u v a b (js :: IxList) (is :: IxList) s t. (m ~ Join k l, Is l m, Is k m, IxOptic l u v a b, NonEmptyIndices js) => Optic k is s t u v -> Optic l js u v a b -> Optic m is s t a b
- reindexed :: forall (is :: IxList) i j k s t a b. HasSingleIndex is i => (i -> j) -> Optic k is s t a b -> Optic k (WithIx j) s t a b
- icompose :: (i -> j -> ix) -> Optic k '[i, j] s t a b -> Optic k (WithIx ix) s t a b
- icompose3 :: (i1 -> i2 -> i3 -> ix) -> Optic k '[i1, i2, i3] s t a b -> Optic k (WithIx ix) s t a b
- icompose4 :: (i1 -> i2 -> i3 -> i4 -> ix) -> Optic k '[i1, i2, i3, i4] s t a b -> Optic k (WithIx ix) s t a b
- icompose5 :: (i1 -> i2 -> i3 -> i4 -> i5 -> ix) -> Optic k '[i1, i2, i3, i4, i5] s t a b -> Optic k (WithIx ix) s t a b
- icomposeN :: forall k i (is :: IxList) s t a b. (CurryCompose is, NonEmptyIndices is) => Curry is i -> Optic k is s t a b -> Optic k (WithIx i) s t a b
- class Functor f => FunctorWithIndex i (f :: Type -> Type) | f -> i where
- imap :: (i -> a -> b) -> f a -> f b
- class (FunctorWithIndex i f, Foldable f) => FoldableWithIndex i (f :: Type -> Type) | f -> i where
- itraverse_ :: (FoldableWithIndex i t, Applicative f) => (i -> a -> f b) -> t a -> f ()
- ifor_ :: (FoldableWithIndex i t, Applicative f) => t a -> (i -> a -> f b) -> f ()
- itoList :: FoldableWithIndex i f => f a -> [(i, a)]
- class (FoldableWithIndex i t, Traversable t) => TraversableWithIndex i (t :: Type -> Type) | t -> i where
- itraverse :: Applicative f => (i -> a -> f b) -> t a -> f (t b)
- ifor :: (TraversableWithIndex i t, Applicative f) => t a -> (i -> a -> f b) -> f (t b)
Class for optic kinds that can be indexed
class IxOptic k s t a b where #
Methods
noIx :: forall (is :: IxList). NonEmptyIndices is => Optic k is s t a b -> Optic k NoIx s t a b #
Instances
| (s ~ t, a ~ b) => IxOptic A_Fold s t a b | |
Defined in Optics.Indexed.Core | |
| (s ~ t, a ~ b) => IxOptic A_Getter s t a b | |
Defined in Optics.Indexed.Core | |
| IxOptic A_Lens s t a b | |
Defined in Optics.Indexed.Core | |
| IxOptic A_Setter s t a b | |
Defined in Optics.Indexed.Core | |
| IxOptic A_Traversal s t a b | |
Defined in Optics.Indexed.Core | |
| (s ~ t, a ~ b) => IxOptic An_AffineFold s t a b | |
Defined in Optics.Indexed.Core | |
| IxOptic An_AffineTraversal s t a b | |
Defined in Optics.Indexed.Core | |
conjoined :: forall (is :: IxList) i k s t a b. HasSingleIndex is i => Optic k NoIx s t a b -> Optic k is s t a b -> Optic k is s t a b #
Composition of indexed optics
(<%>) :: forall m k l s t a b (is :: IxList) i (js :: IxList) j u v. (m ~ Join k l, Is k m, Is l m, IxOptic m s t a b, HasSingleIndex is i, HasSingleIndex js j) => Optic k is s t u v -> Optic l js u v a b -> Optic m (WithIx (i, j)) s t a b #
(%>) :: forall m k l s t u v (is :: IxList) (js :: IxList) a b. (m ~ Join k l, Is k m, Is l m, IxOptic k s t u v, NonEmptyIndices is) => Optic k is s t u v -> Optic l js u v a b -> Optic m js s t a b #
(<%) :: forall m k l u v a b (js :: IxList) (is :: IxList) s t. (m ~ Join k l, Is l m, Is k m, IxOptic l u v a b, NonEmptyIndices js) => Optic k is s t u v -> Optic l js u v a b -> Optic m is s t a b #
reindexed :: forall (is :: IxList) i j k s t a b. HasSingleIndex is i => (i -> j) -> Optic k is s t a b -> Optic k (WithIx j) s t a b #
icompose3 :: (i1 -> i2 -> i3 -> ix) -> Optic k '[i1, i2, i3] s t a b -> Optic k (WithIx ix) s t a b #
icompose4 :: (i1 -> i2 -> i3 -> i4 -> ix) -> Optic k '[i1, i2, i3, i4] s t a b -> Optic k (WithIx ix) s t a b #
icompose5 :: (i1 -> i2 -> i3 -> i4 -> i5 -> ix) -> Optic k '[i1, i2, i3, i4, i5] s t a b -> Optic k (WithIx ix) s t a b #
icomposeN :: forall k i (is :: IxList) s t a b. (CurryCompose is, NonEmptyIndices is) => Curry is i -> Optic k is s t a b -> Optic k (WithIx i) s t a b #
Indexed optic flavours
Functors with index
class Functor f => FunctorWithIndex i (f :: Type -> Type) | f -> i where #
Minimal complete definition
Nothing
Instances
Foldable with index
class (FunctorWithIndex i f, Foldable f) => FoldableWithIndex i (f :: Type -> Type) | f -> i where #
Minimal complete definition
Nothing
Methods
ifoldMap :: Monoid m => (i -> a -> m) -> f a -> m #
Instances
itraverse_ :: (FoldableWithIndex i t, Applicative f) => (i -> a -> f b) -> t a -> f () #
ifor_ :: (FoldableWithIndex i t, Applicative f) => t a -> (i -> a -> f b) -> f () #
itoList :: FoldableWithIndex i f => f a -> [(i, a)] #
Traversable with index
class (FoldableWithIndex i t, Traversable t) => TraversableWithIndex i (t :: Type -> Type) | t -> i where #
Instances
ifor :: (TraversableWithIndex i t, Applicative f) => t a -> (i -> a -> f b) -> f (t b) #
Orphan instances
| FoldableWithIndex Int Vector Source # | |
| FunctorWithIndex Int Vector Source # | |
| TraversableWithIndex Int Vector Source # | |
| FoldableWithIndex k (HashMap k) Source # | |
| FunctorWithIndex k (HashMap k) Source # | |
| TraversableWithIndex k (HashMap k) Source # | |