019f8fd211
git-subtree-dir: users/wpcarro git-subtree-mainline:464bbcb15c
git-subtree-split:24f5a642af
Change-Id: I6105b3762b79126b3488359c95978cadb3efa789
11 lines
235 B
Haskell
11 lines
235 B
Haskell
data Tree a = Node a [Tree a] deriving (Show)
|
|
|
|
withRoot :: [a] -> [Tree a]
|
|
withRoot xs = xs |> toThing |> fmap buildTree
|
|
|
|
buildTree :: (a, [a])
|
|
|
|
|
|
toTree :: [a] -> Tree a
|
|
toTree [x] = Node x []
|
|
toTree [x | xs] = Node x (toTree xs)
|