Question: fill out the Todo part in haskell module A05 where import Data.Maybe (isJust) data ITree a = ILeaf | IBranch a (ITree a) (ITree a)
fill out the Todo part in haskell
module A05 where import Data.Maybe (isJust)
data ITree a = ILeaf | IBranch a (ITree a) (ITree a) deriving (Show, Eq)
-- TODO: you should instantiate the `Functor` type class for `ITree`.
flipTree :: ITree a -> ITree a flipTree = error "TODO: flipTree"
preOrderList :: ITree a -> [a] preOrderList = error "TODO: preOrderList"
balancedHeight :: ITree a -> Maybe Int balancedHeight = error "TODO: balancedHeight"
isBalanced :: ITree a -> Bool isBalanced = isJust . balancedHeight
balancedFromList :: [a] -> ITree a balancedFromList = error "TODO: balancedFromList"
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
