Simplify MetaTrees

This commit is contained in:
2022-06-13 10:25:06 +01:00
parent 768b86d393
commit 31e7f4290e
6 changed files with 97 additions and 84 deletions
+4 -7
View File
@@ -8,13 +8,9 @@ data MetaBranch a
= MBranch {_mbLabel :: String, _mbAttach :: a -> Maybe a, _mbTree :: MetaTree a}
data MetaTree a
= MTree {_mtLabel :: String , _mtTree :: MetaTree a , _mtBranches :: [MetaBranch a] }
| BTree {_btLabel :: String , _btValue :: a , _btBranches :: [MetaTree a] }
mRootLabel :: MetaTree a -> String
mRootLabel mt = case mt of
MTree {} -> _mtLabel mt
BTree {} -> _btLabel mt
= MTree {_mtLabel :: String , _mtTree :: MetaNode a , _mtBranches :: [MetaBranch a] }
-- | BTree {_btLabel :: String , _btValue :: a , _btBranches :: [MetaTree a] }
data MetaNode a = NodeTree {_nodeTree :: Tree a} | NodeMTree {_nodeMetaTree :: MetaTree a}
--type CompTree a = Tree (Tree a)
type LabTree a = (a -> Maybe ([String],a),Tree a)
@@ -26,4 +22,5 @@ data TreeSubLabelling = TreeSubLabelling
makeLenses ''TreeSubLabelling
makeLenses ''MetaTree
makeLenses ''MetaBranch
makeLenses ''MetaNode