Confirm generalised tree composition works
This commit is contained in:
@@ -16,6 +16,7 @@ module Dodge.Tree.Compose
|
||||
, attachTree
|
||||
, composeTreeRand
|
||||
, composeAndLog
|
||||
, cmpToMT
|
||||
-- , compTree
|
||||
) where
|
||||
import Dodge.Data
|
||||
@@ -184,3 +185,9 @@ composeAndLog mt = case mt of
|
||||
putStrLn $ drawTree $ logMT mt
|
||||
brs <- mapM composeAndSubLog $ _btBranches mt
|
||||
return $ Node (_btValue mt) brs
|
||||
|
||||
cmpToMT :: Tree (a-> Maybe (b,a), Tree a) -> MetaTree a
|
||||
cmpToMT (Node (_,t) ts) = MTree "A" (tToBT t) (map tToMB ts)
|
||||
where
|
||||
tToMB (Node (f,t') ts') = MBranch "C" (fmap snd . f) $ MTree "D" (tToBT t') (map tToMB ts')
|
||||
tToBT (Node x xs) = BTree "B" x $ map tToBT xs
|
||||
|
||||
Reference in New Issue
Block a user