Question
Define an instance of the Functor class for the following type of binary trees that have data in their nodes:data Tree a = Leaf $\mid$ Node (Tree a) a (Tree a)deriving Show
Step 1
The Functor class has a single method called fmap, which takes a function and applies it to the values inside the functor. To define the Functor instance for Tree, we need to implement the fmap function. The fmap function should take a function f and a Tree a, Show more…
Show all steps
Your feedback will help us improve your experience
Watch the video solution with this free unlock.
EMAIL
PASSWORD