Module
Data.Lens.Barlow.Indexed
- Package
- purescript-barlow-lens
- Repository
- sigma-andex/purescript-barlow-lens
Construction of indexed barlow optics, i.e. paths containing at least one #.
A path is split at its first #. The part before it is an ordinary barlow optic,
the # itself becomes an indexed traversal, and the remainder is built at the
profunctor Indexed p i, so the index is carried all the way to the focus.
Each further # adds its index to the right: Tuple (Tuple i j) k.
#ConstructIndexed Source
class ConstructIndexed :: TList -> (Type -> Type -> Type) -> Type -> Type -> Type -> Type -> Type -> Constraintclass ConstructIndexed (lenses :: TList) p i s t a b | lenses s -> t a b i where
Builds an indexed optic from a lens list.
Members
constructIndexed :: Proxy lenses -> IndexedOptic p i s t a b
Instances
(SplitHash lenses split, ConstructIndexedSplit split p i s t a b) => ConstructIndexed lenses p i s t a b
#ConstructIndexedSplit Source
class ConstructIndexedSplit :: Split -> (Type -> Type -> Type) -> Type -> Type -> Type -> Type -> Type -> Constraintclass ConstructIndexedSplit (split :: Split) p i s t a b | split s -> t a b i where
Members
constructIndexedSplit :: Proxy split -> IndexedOptic p i s t a b
Instances
(Fail (Text "barlow: an indexed optic needs at least one `#` in its path"), Unreachable) => ConstructIndexedSplit (NoHash lenses) p i s t a b(ConstructBarlow prefix p s t fx fy, IndexedStep fx fy x y j, Wander p, ConstructIndexedRest rest p j x y a b i) => ConstructIndexedSplit (HashAt prefix rest) p i s t a b
#ConstructIndexedRest Source
class ConstructIndexedRest :: TList -> (Type -> Type -> Type) -> Type -> Type -> Type -> Type -> Type -> Type -> Constraintclass ConstructIndexedRest (lenses :: TList) p j s t a b i | lenses j s -> t a b i where
Builds the part of the path after a #, where the current index is j.
Members
constructIndexedRest :: Proxy lenses -> Indexed p i a b -> Indexed p j s t
Instances
(SplitHash lenses split, ConstructIndexedRestSplit split p j s t a b i) => ConstructIndexedRest lenses p j s t a b i
#ConstructIndexedRestSplit Source
class ConstructIndexedRestSplit :: Split -> (Type -> Type -> Type) -> Type -> Type -> Type -> Type -> Type -> Type -> Constraintclass ConstructIndexedRestSplit (split :: Split) p j s t a b i | split j s -> t a b i where
Members
constructIndexedRestSplit :: Proxy split -> Indexed p i a b -> Indexed p j s t
Instances
(ConstructBarlow lenses (Indexed p j) s t a b) => ConstructIndexedRestSplit (NoHash lenses) p j s t a b j(ConstructBarlow prefix (Indexed p j) s t fu fv, IndexedStep fu fv u v k, Wander p, ConstructIndexedRest rest p (Tuple j k) u v a b i) => ConstructIndexedRestSplit (HashAt prefix rest) p j s t a b i
#IndexedStep Source
class IndexedStep s t a b i | s -> t a b i whereThe optic introduced by #: an indexed traversal over a TraversableWithIndex,
or over all fields of a homogeneous record (indexed by field name).
Members
indexedStep :: forall p. Wander p => IndexedOptic p i s t a b
Instances
(RowToList r rl, RecordElem rl a, TraverseFields rl r a) => IndexedStep (Record r) (Record r) a a String(TraversableWithIndex i f) => IndexedStep (f a) (f b) a b i