module Main (main) where data BinTree a = Empty | Node a (BinTree a) (BinTree a) deriving (Show) showTree :: Show a => BinTree a -> Int -> String showTree (Empty) _ = [] showTree (Node t l r) n = replicate n '*' ++ show t ++ "\n" ++ showTree l (n+1) ++ showTree r (n+1) main :: IO () main = do let x = Node "Parent" (Node "childLeft" (Node "grandChildLeftLeft" Empty Empty) Empty) (Node "childRight" Empty Empty) putStrLn $ showTree x 0