Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- (%) :: (Additive - Semigroup) i => Representable p => IndexedOptic p i b1 b2 a1 a2 -> IndexedOptic p i c1 c2 b1 b2 -> IndexedOptic p i c1 c2 a1 a2
- iinit :: Profunctor p => IndexedOptic p i s t a b -> IndexedOptic p (First i) s t a b
- ilast :: Profunctor p => IndexedOptic p i s t a b -> IndexedOptic p (Last i) s t a b
- reix :: Profunctor p => (i -> j) -> (j -> i) -> IndexedOptic p i s t a b -> IndexedOptic p j s t a b
- imap :: Profunctor p => (s -> a) -> (b -> t) -> IndexedOptic p i s t a b
- withIxrepn :: Representable p => IndexedOptic p i s t a b -> i -> s -> (i -> a -> Rep p b) -> Rep p t
- (#) :: (Additive - Semigroup) k => Corepresentable p => CoindexedOptic p k b1 b2 a1 a2 -> CoindexedOptic p k c1 c2 b1 b2 -> CoindexedOptic p k c1 c2 a1 a2
- kinit :: Profunctor p => CoindexedOptic p k s t a b -> CoindexedOptic p (First k) s t a b
- klast :: Profunctor p => CoindexedOptic p k s t a b -> CoindexedOptic p (Last k) s t a b
- recx :: Profunctor p => (k -> l) -> (l -> k) -> CoindexedOptic p k s t a b -> CoindexedOptic p l s t a b
- kmap :: Profunctor p => (s -> a) -> (b -> t) -> CoindexedOptic p k s t a b
- cxed :: Strong p => Iso (Cx p s s t) (Cx p k a b) (p s t) (p a b)
- kjoin :: Strong p => Cx p a a b -> p a b
- kreturn :: Profunctor p => p a b -> Cx p k a b
- type Cx' p a b = Cx p a a b
- kunit :: Strong p => Cx' p :-> p
- kpastro :: Profunctor p => Iso (Cx' p a b) (Cx' p c d) (Pastro p a b) (Pastro p c d)
- kfirst' :: Profunctor p => Cx' p a b -> Cx' p (a, c) (b, c)
- withCxrepn :: Corepresentable p => CoindexedOptic p k s t a b -> Corep p s -> k -> (Corep p a -> k -> b) -> t
- data Index a b s = Index a (b -> s)
- vals :: Index a b s -> b -> s
- info :: Index a b s -> a
- newtype Coindex a b s = Coindex {
- runCoindex :: (s -> a) -> b
- trivial :: Coindex a b a -> b
- noindex :: Monoid s => (a -> b) -> Coindex a b s
- coindex :: Functor f => s -> (a -> b) -> Coindex (f a) (f b) s
- (.#.) :: Semigroup s => Coindex b c s -> Coindex a b s -> Coindex a c s
- newtype Conjoin j a b = Conjoin {
- unConjoin :: j -> a -> b
Indexing
(%) :: (Additive - Semigroup) i => Representable p => IndexedOptic p i b1 b2 a1 a2 -> IndexedOptic p i c1 c2 b1 b2 -> IndexedOptic p i c1 c2 a1 a2 infixr 8 Source #
iinit :: Profunctor p => IndexedOptic p i s t a b -> IndexedOptic p (First i) s t a b Source #
ilast :: Profunctor p => IndexedOptic p i s t a b -> IndexedOptic p (Last i) s t a b Source #
reix :: Profunctor p => (i -> j) -> (j -> i) -> IndexedOptic p i s t a b -> IndexedOptic p j s t a b Source #
Map over the indices of an indexed optic.
See also reixed
.
imap :: Profunctor p => (s -> a) -> (b -> t) -> IndexedOptic p i s t a b Source #
withIxrepn :: Representable p => IndexedOptic p i s t a b -> i -> s -> (i -> a -> Rep p b) -> Rep p t Source #
Coindexing
(#) :: (Additive - Semigroup) k => Corepresentable p => CoindexedOptic p k b1 b2 a1 a2 -> CoindexedOptic p k c1 c2 b1 b2 -> CoindexedOptic p k c1 c2 a1 a2 infixr 8 Source #
Compose two coindexed traversals, combining indices.
Its precedence is one lower than that of function composition, which allows . to be nested in #.
If you only need the final index then use ..
kinit :: Profunctor p => CoindexedOptic p k s t a b -> CoindexedOptic p (First k) s t a b Source #
klast :: Profunctor p => CoindexedOptic p k s t a b -> CoindexedOptic p (Last k) s t a b Source #
recx :: Profunctor p => (k -> l) -> (l -> k) -> CoindexedOptic p k s t a b -> CoindexedOptic p l s t a b Source #
Map over the indices of a coindexed optic.
See also recxed
.
kmap :: Profunctor p => (s -> a) -> (b -> t) -> CoindexedOptic p k s t a b Source #
kreturn :: Profunctor p => p a b -> Cx p k a b Source #
withCxrepn :: Corepresentable p => CoindexedOptic p k s t a b -> Corep p s -> k -> (Corep p a -> k -> b) -> t Source #
Index
An indexed store that characterizes a Lens
,Index
a b s ≡ forall f. Functor
f => (a -> f b) -> f s
See also withLensVl
.
Index a (b -> s) |
Instances
Profunctor (Index a) Source # | |
Defined in Data.Profunctor.Optic.Index | |
Functor (Index a b) Source # | |
a ~ b => Foldable (Index a b) Source # | |
Defined in Data.Profunctor.Optic.Index fold :: Monoid m => Index a b m -> m # foldMap :: Monoid m => (a0 -> m) -> Index a b a0 -> m # foldr :: (a0 -> b0 -> b0) -> b0 -> Index a b a0 -> b0 # foldr' :: (a0 -> b0 -> b0) -> b0 -> Index a b a0 -> b0 # foldl :: (b0 -> a0 -> b0) -> b0 -> Index a b a0 -> b0 # foldl' :: (b0 -> a0 -> b0) -> b0 -> Index a b a0 -> b0 # foldr1 :: (a0 -> a0 -> a0) -> Index a b a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Index a b a0 -> a0 # toList :: Index a b a0 -> [a0] # null :: Index a b a0 -> Bool # length :: Index a b a0 -> Int # elem :: Eq a0 => a0 -> Index a b a0 -> Bool # maximum :: Ord a0 => Index a b a0 -> a0 # minimum :: Ord a0 => Index a b a0 -> a0 # | |
Sieve (LensRep a b) (Index a b) Source # | |
Defined in Data.Profunctor.Optic.Carrier | |
Sieve (IsoRep a b) (Index a b) Source # | |
Defined in Data.Profunctor.Optic.Carrier | |
Generic (Index a b s) Source # | |
type Rep (Index a b s) Source # | |
Defined in Data.Profunctor.Optic.Index type Rep (Index a b s) = D1 (MetaData "Index" "Data.Profunctor.Optic.Index" "profunctor-optics-0.0.1-EeBm7Uc3lv1EUNgahi3W1m" False) (C1 (MetaCons "Index" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (b -> s)))) |
Coindex
newtype Coindex a b s Source #
An indexed continuation that characterizes a Grate
,Coindex
a b s ≡ forall f. Functor
f => (f a -> b) -> f s
See also withGrateVl
.
Coindex
can also be used to compose indexed maps, folds, or traversals directly.
For example, using the containers
library:
Coindex mapWithKey :: Coindex (a -> b) (Map k a -> Map k b) k Coindex foldMapWithKey :: Monoid m => Coindex (a -> m) (Map k a -> m) k Coindex traverseWithKey :: Applicative t => Coindex (a -> t b) (Map k a -> t (Map k b)) k
Coindex | |
|
Instances
Functor (Coindex a b) Source # | |
a ~ b => Applicative (Coindex a b) Source # | |
Defined in Data.Profunctor.Optic.Index | |
a ~ b => Apply (Coindex a b) Source # | |
Defined in Data.Profunctor.Optic.Index | |
Cosieve (GrateRep a b) (Coindex a b) Source # | |
Defined in Data.Profunctor.Optic.Carrier | |
Cosieve (IsoRep a b) (Coindex a b) Source # | |
Defined in Data.Profunctor.Optic.Carrier | |
Generic (Coindex a b s) Source # | |
type Rep (Coindex a b s) Source # | |
Defined in Data.Profunctor.Optic.Index |
noindex :: Monoid s => (a -> b) -> Coindex a b s Source #
Lift a regular function into a coindexed function.
For example, to traverse two layers, keeping only the first index:
CoindexmapWithKey
.#. noindexmap
:: Monoid k => Coindex (a -> b) (Map k (Map j a) -> Map k (Map j b)) k
(.#.) :: Semigroup s => Coindex b c s -> Coindex a b s -> Coindex a c s infixr 9 Source #
Compose two coindexes.
When s is a Monoid
, Coindex
can be used to compose indexed traversals, folds, etc.
For example, to keep track of only the first index seen, use Data.Monoid.First
:
fmap (First . pure) :: Coindex a b c -> Coindex a b (First c)
or keep track of all indices using a list:
fmap (:[]) :: Coindex a b c -> Coindex a b [c]
Coindex
newtype Conjoin j a b Source #