diff options
| author | peb <unknown> | 2005-02-24 10:46:37 +0000 |
|---|---|---|
| committer | peb <unknown> | 2005-02-24 10:46:37 +0000 |
| commit | bf436aebaa5b84bbb50e305e8f7dc9ca4ae34299 (patch) | |
| tree | 346ac1e13a90d7b2c992c69f45b3e19c22f4bfe2 /src/GF/Data/Zipper.hs | |
| parent | 0137dd5511a83ea4672619ad3dc22fe7c51ab4bf (diff) | |
"Committed_by_peb"
Diffstat (limited to 'src/GF/Data/Zipper.hs')
| -rw-r--r-- | src/GF/Data/Zipper.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/GF/Data/Zipper.hs b/src/GF/Data/Zipper.hs index c56552104..11643b765 100644 --- a/src/GF/Data/Zipper.hs +++ b/src/GF/Data/Zipper.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/02/18 19:21:16 $ +-- > CVS $Date: 2005/02/24 11:46:36 $ -- > CVS $Author: peb $ --- > CVS $Revision: 1.6 $ +-- > CVS $Revision: 1.7 $ -- -- Gérard Huet's zipper (JFP 7 (1997)). AR 10\/8\/2001 ----------------------------------------------------------------------------- @@ -62,6 +62,7 @@ data Path a = | Node ([Tr a], (Path a, a), [Tr a]) deriving Show +leaf :: a -> Tr a leaf a = Tr (a,[]) newtype Loc a = Loc (Tr a, Path a) deriving Show @@ -132,6 +133,7 @@ goBackN i st -- added mappings between locations and trees +loc2tree :: Loc a -> Tr a loc2tree (Loc (t,p)) = case p of Top -> t Node (left,(p',v),right) -> @@ -143,8 +145,10 @@ loc2treeMarked (Loc (Tr (a,ts),p)) = where (mark, nomark) = (\a -> (a,True), \a -> (a, False)) +tree2loc :: Tr a -> Loc a tree2loc t = Loc (t,Top) +goRoot :: Loc a -> Loc a goRoot = tree2loc . loc2tree goLast :: Loc a -> Err (Loc a) |
