summaryrefslogtreecommitdiffstats
path: root/TreeZipperUtils.hs
blob: b6410a375c1c4796e274f888ed186f6937544138 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
module TreeZipperUtils where

import Data.Tree
import Data.Tree.Zipper

-- Return loc (as parent-like structure) and  parents.
path :: TreePos Full a -> [(Forest a, a, Forest a)]
path loc = toParent loc : parents loc

-- Return parent stack compatible form of loc.
toParent :: TreePos Full a -> (Forest a, a, Forest a)
toParent loc = (before loc, label loc, after loc)