ListZipper-1.1.0.0: Simple zipper for lists

Data.List.Zipper

Synopsis

Documentation

data Zipper a Source

Constructors

Zip ![a] ![a] 

toList :: Zipper a -> [a]Source

cursor :: Zipper a -> aSource

cursor z returns the targeted element in z.

This function is not total, but the invariant is that endp z == False means that you can safely call cursor z.

push :: a -> Zipper a -> Zipper aSource

insert :: a -> Zipper a -> Zipper aSource

replace :: a -> Zipper a -> Zipper aSource

replace a z changes the current element in the zipper to the passed in value. If there is no current element, the zipper is unchanged. If you want to add the element in that case instead, use insert a (delete z).