|
| Generics.MultiRec.Zipper | | Portability | non-portable | | Stability | experimental | | Maintainer | generics@haskell.org |
|
|
|
|
|
| Description |
| The generic zipper.
|
|
| Synopsis |
|
|
|
|
| Locations
|
|
|
| Abstract type of locations. A location contains the current focus
and its context. A location is parameterized over the system of
datatypes and over the type of the complete value.
|
|
|
| Context frames
|
|
| data family Ctx f :: (* -> *) -> (* -> *) -> * -> * -> * | Source |
|
| Abstract type of context frames. Not required for the high-level
navigation functions.
|
|
|
| Generic zipper class
|
|
|
| It is in general not necessary to use the generic navigation
functions directly. The functions listed in the `Interface' section
below are more user-friendly.
| | | Methods | | cmap :: (forall b. Ix s b => s b -> r b -> r' b) -> Ctx f s r ix b -> Ctx f s r' ix b | Source |
| | | fill :: Ix s b => Ctx f s r ix b -> r b -> f s r ix | Source |
| | | first :: (forall b. Ix s b => r b -> Ctx f s r ix b -> a) -> f s r ix -> Maybe a | Source |
| | | last :: (forall b. Ix s b => r b -> Ctx f s r ix b -> a) -> f s r ix -> Maybe a | Source |
| | | next :: (forall b. Ix s b => r b -> Ctx f s r ix b -> a) -> Ix s b => Ctx f s r ix b -> r b -> Maybe a | Source |
| | | prev :: (forall b. Ix s b => r b -> Ctx f s r ix b -> a) -> Ix s b => Ctx f s r ix b -> r b -> Maybe a | Source |
|
| | Instances | |
|
|
| Interface
|
|
|
| Start navigating a datastructure. Returns a location that
focuses the entire value and has an empty context.
|
|
|
| Move down to the leftmost child. Returns Nothing if the
current focus is a leaf.
|
|
|
| Move down to the rightmost child. Returns Nothing if the
current focus is a leaf.
|
|
|
| Move up to the parent. Returns Nothing if the current
focus is the root.
|
|
|
| Move to the right sibling. Returns Nothing if the current
focus is the rightmost sibling.
|
|
|
| Move to the left sibling. Returns Nothing if the current
focus is the leftmost sibling.
|
|
|
| Move through all positions in depth-first left-to-right order.
|
|
|
| Move through all positions in depth-first right-to-left order.
|
|
|
| Return the entire value, independent of the current focus.
|
|
| on :: (forall xi. Ix s xi => s xi -> r xi -> a) -> Loc s r ix -> a | Source |
|
| Operate on the current focus. This function can be used to
extract the current point of focus.
|
|
|
| Update the current focus without changing its type.
|
|
| foldZipper :: (forall xi. Ix s xi => s xi -> xi -> r xi) -> Algebra s r -> Loc s I0 ix -> r ix | Source |
|
| Most general eliminator. Both on and update can be defined
in terms of foldZipper.
|
|
| Produced by Haddock version 2.4.2 |