From 615f91d2db515ad387abcf7f7f50ef93be10163a Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 4 Jan 2015 14:42:38 +0100 Subject: add missing TreeZipperUtils.hs --- TreeZipperUtils.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 TreeZipperUtils.hs (limited to 'TreeZipperUtils.hs') diff --git a/TreeZipperUtils.hs b/TreeZipperUtils.hs new file mode 100644 index 0000000..b6410a3 --- /dev/null +++ b/TreeZipperUtils.hs @@ -0,0 +1,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) -- cgit v1.2.3