Portability | rank 2 types, MPTCs, TFs, flexible |
---|---|
Stability | provisional |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | Safe-Infered |
- class Indexed i k where
- index :: ((i -> a) -> b) -> k a b
- type Indexable i a b = forall k. Indexed i k => k a b
- newtype Index i a b = Index {
- withIndex :: (i -> a) -> b
- (.@) :: Indexed (i, j) k => Index i b c -> Index j a b -> k a c
- composeWithIndex :: Indexed k r => (i -> j -> k) -> Index i b c -> Index j a b -> r a c
- reindex :: Indexed j k => (i -> j) -> Index i a b -> k a b
- type IndexedFold i a c = forall k f b d. (Indexed i k, Applicative f, Gettable f) => k (c -> f d) (a -> f b)
- foldMapWithIndexOf :: IndexedFolding i m a b c d -> (i -> c -> m) -> a -> m
- foldrWithIndexOf :: IndexedFolding i (Endo e) a b c d -> (i -> c -> e -> e) -> e -> a -> e
- type IndexedTraversal i a b c d = forall f k. (Indexed i k, Applicative f) => k (c -> f d) (a -> f b)
- traverseWithIndexOf :: Overloaded (Index i) f a b c d -> (i -> c -> f d) -> a -> f b
- mapMWithIndexOf :: Overloaded (Index i) (WrappedMonad m) a b c d -> (i -> c -> m d) -> a -> m b
- type IndexedSetter i a b c d = forall f k. (Indexed i k, Settable f) => k (c -> f d) (a -> f b)
- mapWithIndexOf :: 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
- type SimpleIndexedTraversal i a b = IndexedTraversal i a a b b
- type SimpleIndexedSetter i a b = IndexedSetter i a a b b
Indexed Functions
Permit overloading of function application for things that also admit a notion of a key or index.
Provides overloading for indexed functions.
type Indexable i a b = forall k. Indexed i k => k a bSource
Type alias for passing around polymorphic indexed functions.
A function with access to a index. This constructor may be useful when you need to store
a HasIndex
.
(.@) :: Indexed (i, j) k => Index i b c -> Index j a b -> k a cSource
Composition of indexed functions
composeWithIndex :: Indexed k r => (i -> j -> k) -> Index i b c -> Index j a b -> r a cSource
Composition of indexed functions with a user supplied function for combining indexs
Indexed Folds
type IndexedFold i a c = forall k f b d. (Indexed i k, Applicative f, Gettable f) => k (c -> f d) (a -> f b)Source
Every IndexedFold
is a valid Fold
.
foldMapWithIndexOf :: IndexedFolding i m a b c d -> (i -> c -> m) -> a -> mSource
foldMapWithIndexOf :: Monoid m => IndexedFold i a c -> (i -> c -> m) -> a -> m foldMapWithIndexOf :: Monoid m => IndexedTraversal i a b c d -> (i -> c -> m) -> a -> m
foldrWithIndexOf :: IndexedFolding i (Endo e) a b c d -> (i -> c -> e -> e) -> e -> a -> eSource
Indexed Traversals
type IndexedTraversal i a b c d = forall f k. (Indexed i k, Applicative f) => k (c -> f d) (a -> f b)Source
Every indexed traversal is a valid Traversal or indexed fold.
The Traversal laws are still required to hold.
traverseWithIndexOf :: Overloaded (Index i) f a b c d -> (i -> c -> f d) -> a -> f bSource
traverseWithIndexOf :: IndexedTraversal i a b c d -> (i -> c -> f d) -> a -> f b
mapMWithIndexOf :: Overloaded (Index i) (WrappedMonad m) a b c d -> (i -> c -> m d) -> a -> m bSource
Map each element of a structure targeted by a lens to a monadic action, evaluate these actions from left to right, and collect the results, with access its position.
mapMWithIndexOf :: Monad m => IndexedTraversal a b c d -> (i -> c -> m d) -> a -> m 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 indexed Setter is a valid Setter
The Setter laws are still required to hold.
mapWithIndexOf :: Overloaded (Index i) Mutator a b c d -> (i -> c -> d) -> a -> bSource
Map with index
mapWithIndexOf :: IndexedSetter i a b c d -> (i -> c -> d) -> a -> b
(%@) :: Overloaded (Index i) Mutator a b c d -> (i -> c -> d) -> a -> bSource
(%@) = mapWithIndexOf
Simple
type SimpleIndexedTraversal i a b = IndexedTraversal i a a b bSource
type 'SimpleIdexedTraversal i =Simple
(IndexedTraversal
i)
type SimpleIndexedSetter i a b = IndexedSetter i a a b bSource
type 'SimpleIdexedTraversal i =Simple
(IndexedTraversal
i)