Question: Haskell Programming (Not any other Language): Simply answer the question (Code) For Problems 4-7, we'll use this definition of binary trees that include values at

Haskell Programming (Not any other Language): Simply answer the question (Code)Haskell Programming (Not any other Language): Simply answer the question (Code) For

For Problems 4-7, we'll use this definition of binary trees that include values at the leafs and interior nodes. Tree is polymorphic, so you can have a Tree Int or Tree Float or Tree (Int, Int), etc. data Tree aLeaf a Branch a (Tree a) (Tree a) deriving (Eq, Show) 4.[5 points] Wrie a treeEq function that is our own version of tree equality. It should behave just like ::: If x and y are trees, then ( treeEg x-treeEq y ) == ( x- y). For the function type, you need two trees of an equality-testable type. (You can't test treeEq (Leaf sqrt) (Leaf sqrt), for example.) 5. 5 points] Write a treeShow function that is our own version of show. It should take a tree and return a string (a list of characters). It should behave just like show: If x is a tree, then tre eshow x == show X. For the function type, you need a tree of showable values. (You can't treeShow (Leaf sqrt), for example.) For Problems 4-7, we'll use this definition of binary trees that include values at the leafs and interior nodes. Tree is polymorphic, so you can have a Tree Int or Tree Float or Tree (Int, Int), etc. data Tree aLeaf a Branch a (Tree a) (Tree a) deriving (Eq, Show) 4.[5 points] Wrie a treeEq function that is our own version of tree equality. It should behave just like ::: If x and y are trees, then ( treeEg x-treeEq y ) == ( x- y). For the function type, you need two trees of an equality-testable type. (You can't test treeEq (Leaf sqrt) (Leaf sqrt), for example.) 5. 5 points] Write a treeShow function that is our own version of show. It should take a tree and return a string (a list of characters). It should behave just like show: If x is a tree, then tre eshow x == show X. For the function type, you need a tree of showable values. (You can't treeShow (Leaf sqrt), for example.)

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!