summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-01-04 14:42:38 +0100
committertv <tv@shackspace.de>2015-01-04 14:42:38 +0100
commit615f91d2db515ad387abcf7f7f50ef93be10163a (patch)
tree0da6c076bf6251243ddf8d66842a6b4cb6e819de
parent9930c942b24bb12d8273b2026f48013a25ad0983 (diff)
add missing TreeZipperUtils.hs
-rw-r--r--TreeZipperUtils.hs12
1 files changed, 12 insertions, 0 deletions
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)