Improve composing tree logging

This commit is contained in:
2022-06-13 18:42:18 +01:00
parent 7a07fc97c2
commit 5f088bdb4b
5 changed files with 61 additions and 2 deletions
+5
View File
@@ -10,6 +10,11 @@ data MetaTree a b = MTree {_mtLabel :: b , _mtTree :: MetaNode a b, _mtBranches
data MetaNode a b = NodeTree {_nodeTree :: Tree a} | NodeMTree {_nodeMetaTree :: MetaTree a b}
data MetaBranch a b = MBranch {_mbAttach :: a -> Maybe a, _mbTree :: MetaTree a b}
newtype SelfTree a = ST {_unST :: Tree (a,Either (Tree a) (SelfTree a))}
makeLenses ''MetaTree
makeLenses ''MetaBranch
makeLenses ''MetaNode
instance Functor (MetaTree a) where
fmap f (MTree b mn bs) = MTree (f b) (mn & nodeMetaTree %~ fmap f) (map (mbTree %~ fmap f) bs)