{- | Description: Binary trees Copyright: Copyright (C) 2021 Yoo Chung License: GPL-3.0-or-later Maintainer: dev@chungyc.org Part of Ninety-Nine Haskell "Problems". Some solutions are in "Solutions.P54". -} module Problems.P54 (Tree, leaf, tree1, tree2, tree3, tree4) where import Problems.BinaryTrees import qualified Solutions.P54 as Solution -- | Define a shorthand function for constructing a leaf node. -- -- A leaf node in 'Tree' is a branch with two empty subtrees. leaf :: a -> Tree a leaf :: forall a. a -> Tree a leaf = a -> Tree a forall a. a -> Tree a Solution.leaf -- | Define as the tree as shown in the following. -- --  tree1 :: Tree Char tree1 :: Tree Char tree1 = Tree Char Solution.tree1 -- | Define as a binary tree consisting of only a single root node with value @\'a\'@. tree2 :: Tree Char tree2 :: Tree Char tree2 = Tree Char Solution.tree2 -- | Define as an empty binary tree. tree3 :: Tree Char tree3 :: Tree Char tree3 = Tree Char Solution.tree3 -- | Define as the following tree with integer values. -- --  tree4 :: Tree Int tree4 :: Tree Int tree4 = Tree Int Solution.tree4