directory-contents-0.2.0.0: Recursively build, navigate, and operate on a tree of directory contents.

Safe HaskellSafe
LanguageHaskell2010

System.Directory.Contents.Zipper

Contents

Description

This module should be imported qualified due to the very short names it exports.

Synopsis

Zipper

data DirZipper a Source #

A zipper for a DirTree. As you navigate the tree, this keeps track of where you are (which node is "focused" under your cursor) and how to reach parent, child, and sibling nodes.

Constructors

DirZipper 

Fields

Instances
Eq a => Eq (DirZipper a) Source # 
Instance details

Defined in System.Directory.Contents.Zipper

Methods

(==) :: DirZipper a -> DirZipper a -> Bool #

(/=) :: DirZipper a -> DirZipper a -> Bool #

Ord a => Ord (DirZipper a) Source # 
Instance details

Defined in System.Directory.Contents.Zipper

Read a => Read (DirZipper a) Source # 
Instance details

Defined in System.Directory.Contents.Zipper

Show a => Show (DirZipper a) Source # 
Instance details

Defined in System.Directory.Contents.Zipper

zipped :: DirTree a -> DirZipper a Source #

Construct a zipper out of a DirTree. Use focused or unzipped to get back a DirTree

focused :: DirZipper a -> DirTree a Source #

The currently focused/selected node (and its children). In other words, where you are in the directory hierarchy.

unzipped :: DirZipper a -> DirTree a Source #

Throws away your current cursor information and returns the entire DirTree contained by the DirZipper.

unzipped . zipped == id

down :: DirZipper a -> Maybe (DirZipper a) Source #

Move down a level in the directory hierarchy. To move down to a specific child, use downTo.

up :: DirZipper a -> Maybe (DirZipper a) Source #

Move up a level in the directory hierarchy, back to the parent that you previously moved down through.

home :: DirZipper a -> DirZipper a Source #

Go to the top of the directory hierarchy.

data NavSibling Source #

Navigation directions for sibling nodes

Constructors

NavLeft 
NavRight 

nextSibling :: NavSibling -> DirZipper a -> Maybe (DirZipper a) Source #

Move to the sibling next to the focused node

left :: DirZipper a -> Maybe (DirZipper a) Source #

Move to the sibling to the left of the focused node

right :: DirZipper a -> Maybe (DirZipper a) Source #

Move to the sibling to the right of the focused node

toSibling :: FileName -> DirZipper a -> Maybe (DirZipper a) Source #

Go to a particular sibling

downTo :: FileName -> DirZipper a -> Maybe (DirZipper a) Source #

Move down in the directory hierarchy to a particular child

mapCursor :: (DirTree a -> DirTree a) -> DirZipper a -> DirZipper a Source #

Modify the focused node

replaceCursor :: DirTree a -> DirZipper a -> DirZipper a Source #

Replace the focused node

insert :: DirTree a -> DirZipper a -> DirZipper a Source #

Add a new sibling to the focused node's generation and focus on it

remove :: DirZipper a -> Maybe (DirZipper a) Source #

Remove the focused node

followRelative :: FilePath -> DirZipper a -> Maybe (DirZipper a) Source #

Try to navigate the provided (possibly relative) path.

followLink :: DirZipper a -> Maybe (DirZipper a) Source #

If the focused node is an internal symlink (see Symlink), try to get to the target.