Polymorphise meta tree labels
This commit is contained in:
@@ -4,23 +4,12 @@ module Dodge.Tree.Compose.Data where
|
||||
import Data.Tree
|
||||
import Control.Lens
|
||||
|
||||
data MetaBranch a
|
||||
= MBranch {_mbLabel :: String, _mbAttach :: a -> Maybe a, _mbTree :: MetaTree a}
|
||||
|
||||
data MetaTree a
|
||||
= 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}
|
||||
--data MetaTree a = MTree {_mtLabel :: String , _mtTree :: MetaNode a , _mtBranches :: [MetaBranch a] }
|
||||
data MetaTree a b = MTree {_mtLabel :: b , _mtTree :: MetaNode a b, _mtBranches :: [MetaBranch a b] }
|
||||
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}
|
||||
|
||||
--type CompTree a = Tree (Tree a)
|
||||
type LabTree a = (a -> Maybe ([String],a),Tree a)
|
||||
type LabCompTree a = Tree (LabTree a)
|
||||
data TreeSubLabelling = TreeSubLabelling
|
||||
{ _topLabel :: String
|
||||
, _subLabels :: Maybe (Tree TreeSubLabelling)
|
||||
}
|
||||
makeLenses ''TreeSubLabelling
|
||||
makeLenses ''MetaTree
|
||||
makeLenses ''MetaBranch
|
||||
makeLenses ''MetaNode
|
||||
|
||||
|
||||
Reference in New Issue
Block a user