elynx-tree-0.4.1: Handle phylogenetic trees

Copyright(c) Dominik Schrempf 2020
LicenseGPL-3.0-or-later
Maintainerdominik.schrempf@gmail.com
Stabilityunstable
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

ELynx.Tree.Zipper

Contents

Description

Creation date: Thu Jul 23 08:42:37 2020.

Synopsis

Data type

data TreePos e a Source #

Tree zipper. For reference, please see http://hackage.haskell.org/package/rosezipper.

Constructors

Pos 

Fields

Instances
(Eq e, Eq a) => Eq (TreePos e a) Source # 
Instance details

Defined in ELynx.Tree.Zipper

Methods

(==) :: TreePos e a -> TreePos e a -> Bool #

(/=) :: TreePos e a -> TreePos e a -> Bool #

(Show e, Show a) => Show (TreePos e a) Source # 
Instance details

Defined in ELynx.Tree.Zipper

Methods

showsPrec :: Int -> TreePos e a -> ShowS #

show :: TreePos e a -> String #

showList :: [TreePos e a] -> ShowS #

Conversion

fromTree :: Tree e a -> TreePos e a Source #

Get a zipper pointing to the root.

toTree :: TreePos e a -> Tree e a Source #

Get the complete tree of the zipper.

Movement

goUp :: TreePos e a -> Maybe (TreePos e a) Source #

Go to parent.

goRoot :: TreePos e a -> TreePos e a Source #

Go to root.

goLeft :: TreePos e a -> Maybe (TreePos e a) Source #

Go to left sibling in current forest.

goRight :: TreePos e a -> Maybe (TreePos e a) Source #

Go to right sibling in current forest.

goChild :: Int -> TreePos e a -> Maybe (TreePos e a) Source #

Go to child with given index in forest.

goPath :: [Int] -> TreePos e a -> Maybe (TreePos e a) Source #

Go to node with given path.

unsafeGoPath :: [Int] -> TreePos e a -> TreePos e a Source #

Got to node with given path. Call error if path is invalid.

Modification

insertTree :: Tree e a -> TreePos e a -> TreePos e a Source #

Insert a new tree into the current focus of the zipper.

insertBranch :: e -> TreePos e a -> TreePos e a Source #

Insert a new branch label into the current focus of the zipper.

insertLabel :: a -> TreePos e a -> TreePos e a Source #

Insert a new node label into the current focus of the zipper.