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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!