Portability | rank 2 types, MPTCs, TFs, flexible |
---|---|
Stability | provisional |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | Safe-Infered |
- type IndexedSetter i a b c d = forall f k. (Indexed i k, Settable f) => k (c -> f d) (a -> f b)
- imapOf :: Overloaded (Index i) Mutator a b c d -> (i -> c -> d) -> a -> b
- (%@~) :: Overloaded (Index i) Mutator a b c d -> (i -> c -> d) -> a -> b
- (%@=) :: MonadState a m => Overloaded (Index i) Mutator a a c d -> (i -> c -> d) -> m ()
- type SimpleIndexedSetter i a b = IndexedSetter i a a b b
Indexed Setter
type IndexedSetter i a b c d = forall f k. (Indexed i k, Settable f) => k (c -> f d) (a -> f b)Source
Every IndexedSetter
is a valid Setter
The Setter
laws are still required to hold.
imapOf :: Overloaded (Index i) Mutator a b c d -> (i -> c -> d) -> a -> bSource
Map with index.
When you do not need access to the index, then mapOf
is more liberal in what it can accept.
mapOf
l =imapOf
l .const
imapOf ::IndexedSetter
i a b c d -> (i -> c -> d) -> a -> b imapOf ::IndexedLens
i a b c d -> (i -> c -> d) -> a -> b imapOf ::IndexedTraversal
i a b c d -> (i -> c -> d) -> a -> b
(%@~) :: Overloaded (Index i) Mutator a b c d -> (i -> c -> d) -> a -> bSource
Adjust every target of an IndexedSetter
, IndexedLens
or IndexedTraversal
with access to the index.
(%@~
) =imapOf
When you do not need access to the index then (%@~
) is more liberal in what it can accept.
l%~
f = l%@~
const
f
(%@~) ::IndexedSetter
i a b c d -> (i -> c -> d) -> a -> b (%@~) ::IndexedLens
i a b c d -> (i -> c -> d) -> a -> b (%@~) ::IndexedTraversal
i a b c d -> (i -> c -> d) -> a -> b
(%@=) :: MonadState a m => Overloaded (Index i) Mutator a a c d -> (i -> c -> d) -> m ()Source
Adjust every target in the current state of an IndexedSetter
, IndexedLens
or IndexedTraversal
with access to the index.
When you do not need access to the index then (%=
) is more liberal in what it can accept.
l%=
f = l%@=
const
f
(%@=) ::MonadState
a m =>IndexedSetter
i a a c d -> (i -> c -> d) -> m () (%@=) ::MonadState
a m =>IndexedLens
i a a c d -> (i -> c -> d) -> m () (%@=) ::MonadState
a m =>IndexedTraversal
i a b c d -> (i -> c -> d) -> m ()
Simple
type SimpleIndexedSetter i a b = IndexedSetter i a a b bSource
typeSimpleIndexedSetter
i =Simple
(IndexedSetter
i)