Safe Haskell | None |
---|
Data.Generics.Uniplate.Zipper
Description
A zipper is a structure for walking a value and manipulating it in constant time.
This module was inspired by the paper: Michael D. Adams. Scrap Your Zippers: A Generic Zipper for Heterogeneous Types, Workshop on Generic Programming 2010.
- data Zipper from to
- zipper :: Uniplate to => to -> Zipper to to
- zipperBi :: Biplate from to => from -> Maybe (Zipper from to)
- fromZipper :: Zipper from to -> from
- left :: Zipper from to -> Maybe (Zipper from to)
- right :: Zipper from to -> Maybe (Zipper from to)
- up :: Zipper from to -> Maybe (Zipper from to)
- down :: Uniplate to => Zipper from to -> Maybe (Zipper from to)
- hole :: Zipper from to -> to
- replaceHole :: to -> Zipper from to -> Zipper from to
Create a zipper and get back the value
data Zipper from to
Zipper structure, whose root type is the first type argument, and whose focus type is the second type argument.
Instances
(Eq from, Eq to) => Eq (Zipper from to) |
zipperBi :: Biplate from to => from -> Maybe (Zipper from to)
Create a zipper with a different focus type from the outer type. Will return
Nothing
if there are no instances of the focus type within the original value.
fromZipper :: Zipper from to -> from
From a zipper take the whole structure, including any modifications.
Navigate within a zipper
down :: Uniplate to => Zipper from to -> Maybe (Zipper from to)
Move one step down from the current position.
Manipulate the zipper hole
replaceHole :: to -> Zipper from to -> Zipper from to
Replace the value currently at the focus of the zipper.