Question: Consider the following binary tree data type. > data Tree a Nil | Node a (Tree a) (Tree a) > deriving (Eq. Read,Show) (a)
Consider the following binary tree data type. > data Tree a Nil | Node a (Tree a) (Tree a) > deriving (Eq. Read,Show) (a) Give the Haskell polymorphic type for mapT, the map function over the binary tree data type above. > mapT:: (b) Give a Haskell code definition for the mapT function. (c) Give the Haskell polymorphic type for foldrT, a foldr function over the binary tree data type above. Note that it doesn't have to conform to Foldable, BUT your type must be consistent with your definition ion part (d). > foldrT :: (d) Give a Haskell code definition for the foldrT function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
