Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Simple zipper data structure
- data Zipper a = Zipper [a] [a]
- focus :: Zipper a -> Maybe a
- moveRight_ :: Zipper a -> Maybe (Zipper a)
- moveRight :: Zipper a -> Maybe (a, Zipper a)
- moveLeft_ :: Zipper a -> Maybe (Zipper a)
- moveLeft :: Zipper a -> Maybe (a, Zipper a)
- zipperFromList :: [a] -> Zipper a
- zipperToList :: Zipper a -> [a]
- mkZipper :: [a] -> [a] -> Zipper a
- zipperView :: Zipper a -> ([a], [a])
Documentation
A linear zipper, where the focus can be optionally after the last element (but not before the first element). That is, the focus is the first element (if exists) of the second list.
Zipper [a] [a] |
zipperFromList :: [a] -> Zipper a Source #
zipperToList :: Zipper a -> [a] Source #
zipperView :: Zipper a -> ([a], [a]) Source #
Head of the second list is the focus (if it is not empty)