Portability | rank 2 types, MPTCs, TFs, flexible |
---|---|
Stability | provisional |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | Trustworthy |
- type IndexedSetter i s t a b = forall f k. (Indexable i k, Settable f) => k (a -> f b) (s -> f t)
- imapOf :: Overloaded (Indexed i) Mutator s t a b -> (i -> a -> b) -> s -> t
- iover :: Overloaded (Indexed i) Mutator s t a b -> (i -> a -> b) -> s -> t
- isets :: ((i -> a -> b) -> s -> t) -> IndexedSetter i s t a b
- (%@~) :: Overloaded (Indexed i) Mutator s t a b -> (i -> a -> b) -> s -> t
- (%@=) :: MonadState s m => Overloaded (Indexed i) Mutator s s a b -> (i -> a -> b) -> m ()
- newtype ReifiedIndexedSetter i s t a b = ReifyIndexedSetter {
- reflectIndexedSetter :: IndexedSetter i s t a b
- type SimpleIndexedSetter i s a = IndexedSetter i s s a a
- type SimpleReifiedIndexedSetter i s a = ReifiedIndexedSetter i s s a a
Indexed Setter
type IndexedSetter i s t a b = forall f k. (Indexable i k, Settable f) => k (a -> f b) (s -> f t)Source
Every IndexedSetter
is a valid Setter
The Setter
laws are still required to hold.
imapOf :: Overloaded (Indexed i) Mutator s t a b -> (i -> a -> b) -> s -> tSource
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 s t a b -> (i -> a -> b) -> s -> timapOf
::IndexedLens
i s t a b -> (i -> a -> b) -> s -> timapOf
::IndexedTraversal
i s t a b -> (i -> a -> b) -> s -> t
iover :: Overloaded (Indexed i) Mutator s t a b -> (i -> a -> b) -> s -> tSource
Map with index. This is an alias for imapOf
.
When you do not need access to the index, then over
is more liberal in what it can accept.
over
l ≡iover
l.
const
iover
::IndexedSetter
i s t a b -> (i -> a -> b) -> s -> tiover
::IndexedLens
i s t a b -> (i -> a -> b) -> s -> tiover
::IndexedTraversal
i s t a b -> (i -> a -> b) -> s -> t
isets :: ((i -> a -> b) -> s -> t) -> IndexedSetter i s t a bSource
(%@~) :: Overloaded (Indexed i) Mutator s t a b -> (i -> a -> b) -> s -> tSource
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 s t a b -> (i -> a -> b) -> s -> t (%@~
) ::IndexedLens
i s t a b -> (i -> a -> b) -> s -> t (%@~
) ::IndexedTraversal
i s t a b -> (i -> a -> b) -> s -> t
(%@=) :: MonadState s m => Overloaded (Indexed i) Mutator s s a b -> (i -> a -> b) -> 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
s m =>IndexedSetter
i s s a b -> (i -> a -> b) -> m () (%@=
) ::MonadState
s m =>IndexedLens
i s s a b -> (i -> a -> b) -> m () (%@=
) ::MonadState
s m =>IndexedTraversal
i s t a b -> (i -> a -> b) -> m ()
Storing Indexed Setters
newtype ReifiedIndexedSetter i s t a b Source
Useful for storage.
ReifyIndexedSetter | |
|
Simple
type SimpleIndexedSetter i s a = IndexedSetter i s s a aSource
typeSimpleIndexedSetter
i =Simple
(IndexedSetter
i)
type SimpleReifiedIndexedSetter i s a = ReifiedIndexedSetter i s s a aSource
typeSimpleIndexedSetter
i =Simple
(ReifiedIndexedSetter
i)