module Music.Theory.Tree where
import qualified Data.Tree as Tree
mdForest :: Tree.Forest String -> String
mdForest :: Forest String -> String
mdForest = [String] -> String
unlines forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Int -> Tree String -> [String]
mdTree Int
0)
mdTree :: Int -> Tree.Tree String -> [String]
mdTree :: Int -> Tree String -> [String]
mdTree Int
k (Tree.Node String
txt Forest String
st) = (forall a. Int -> a -> [a]
replicate (Int
k forall a. Num a => a -> a -> a
* Int
2) Char
' ' forall a. [a] -> [a] -> [a]
++ String
"- " forall a. [a] -> [a] -> [a]
++ String
txt) forall a. a -> [a] -> [a]
: forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Int -> Tree String -> [String]
mdTree (Int
k forall a. Num a => a -> a -> a
+ Int
1)) Forest String
st