diff options
Diffstat (limited to 'src/Fun/Tree.hs')
-rw-r--r-- | src/Fun/Tree.hs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/Fun/Tree.hs b/src/Fun/Tree.hs index 5de4695..354677d 100644 --- a/src/Fun/Tree.hs +++ b/src/Fun/Tree.hs @@ -36,36 +36,3 @@ data FunctionBody = FunctionBody [FunctionBodyElement] deriving Show data FunctionBodyElement = Statement String | FunctionBodyIdentifier String | FunctionBodyParameter String | FunctionBodyString String | FunctionBodyNumber Integer deriving Show - ----- - -data NodeValue = NodeName String | FunctionBlockNode FunctionBlock -- | Type, Lambda, .. (TODO) - deriving Show -data EmptyValue = EmptyValue - deriving Show -data Node = EmptyNode | Node NodeValue [Node] - deriving Show -data Crumb = Crumb NodeValue [Node] [Node] - deriving Show -type Zipper = (Node, [Crumb]) - -(-:) :: Maybe Zipper -> (Maybe Zipper -> Maybe Zipper) -> Maybe Zipper -u -: f = f u - -nodePred :: (NodeValue -> Bool) -> Node -> Bool -nodePred pred (Node value _) = pred value -nodePred _ _ = False - --- One layer search from top -treeTo :: (NodeValue -> Bool) -> Maybe Zipper -> Maybe Zipper -treeTo _ Nothing = Nothing -treeTo pred (Just (EmptyNode, _)) = Nothing -treeTo pred (Just (Node value nodes, bs)) = - let (ls, node : rs) = break (nodePred pred) nodes - in Just (node, Crumb value ls rs : bs) - -treeUp :: Maybe Zipper -> Maybe Zipper -treeUp Nothing = Nothing -treeUp (Just (EmptyNode, _)) = Nothing -treeUp (Just (node, Crumb value ls rs : bs)) = - Just (Node value (ls ++ [node] ++ rs), bs) |