| Portability | rank 2 types, MPTCs, TFs, flexible |
|---|---|
| Stability | provisional |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Safe Haskell | Safe-Inferred |
Control.Lens.Indexed
Description
Combinators for working with Indexed functions.
- class Indexable i k where
- indexed :: ((i -> a) -> b) -> k a b
- newtype Indexed i a b = Indexed {
- withIndex :: (i -> a) -> b
- (<.>) :: Indexable (i, j) k => Indexed i b c -> Indexed j a b -> k a c
- (<.) :: Indexable i k => Indexed i b c -> (a -> b) -> k a c
- (.>) :: Indexable i k => (b -> c) -> Indexed i a b -> k a c
- icompose :: Indexable k r => (i -> j -> k) -> Indexed i b c -> Indexed j a b -> r a c
- reindexed :: Indexable j k => (i -> j) -> Indexed i a b -> k a b
- indexing :: Indexable Int k => ((a -> Indexing f b) -> s -> Indexing f t) -> k (a -> f b) (s -> f t)
Documentation
class Indexable i k whereSource
This class permits overloading of function application for things that also admit a notion of a key or index.
Indexed Functions
A function with access to a index. This constructor may be useful when you need to store
a Indexable in a container to avoid ImpredicativeTypes.
(<.>) :: Indexable (i, j) k => Indexed i b c -> Indexed j a b -> k a cSource
Composition of Indexed functions
Mnemonically, the < and > points to the fact that we want to preserve the indices.
(<.) :: Indexable i k => Indexed i b c -> (a -> b) -> k a cSource
Compose an Indexed function with a non-indexed function.
Mnemonically, the < points to the indexing we want to preserve.
(.>) :: Indexable i k => (b -> c) -> Indexed i a b -> k a cSource
Compose a non-indexed function with an Indexed function.
Mnemonically, the > points to the indexing we want to preserve.
icompose :: Indexable k r => (i -> j -> k) -> Indexed i b c -> Indexed j a b -> r a cSource
Composition of Indexed functions with a user supplied function for combining indices
Indexing existing lenses, traversals, etc.
indexing :: Indexable Int k => ((a -> Indexing f b) -> s -> Indexing f t) -> k (a -> f b) (s -> f t)Source
Transform an Traversal into an IndexedTraversal or
a Fold into an IndexedFold, etc.
indexing::Traversals t a b ->IndexedTraversalInts t a bindexing::Prisms t a b ->IndexedTraversalInts t a bindexing::Lenss t a b ->IndexedLensInts t a bindexing::Isos t a b ->IndexedLensInts t a bindexing::Folds t ->IndexedFoldInts tindexing::Getters t ->IndexedGetterInts t a b