Implement more general tree composition
This commit is contained in:
@@ -3,19 +3,22 @@
|
||||
module Dodge.Tree.Compose.Data where
|
||||
import Data.Tree
|
||||
import Control.Lens
|
||||
data ComposingNode a
|
||||
= SplitDown {_unCompose :: a}
|
||||
-- | useAll {_unCompose :: a}
|
||||
| UseSome {_composeIndices :: [Int], _unCompose :: a}
|
||||
| UseNone {_unCompose :: a}
|
||||
-- | useLabel {_composeIndex :: Int, _unCompose :: a} -- defaults to using no children
|
||||
type CompTree a = Tree (Tree a)
|
||||
|
||||
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] }
|
||||
|
||||
--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 ''ComposingNode
|
||||
makeLenses ''TreeSubLabelling
|
||||
makeLenses ''MetaTree
|
||||
makeLenses ''MetaBranch
|
||||
|
||||
|
||||
Reference in New Issue
Block a user