Question: Haskell For Problem 2, we'll use a List type constructor modified from lecture: It uses Lnode and LNil as constructors (to avoid name clashes with
Haskell

For Problem 2, we'll use a List type constructor modified from lecture: It uses Lnode and LNil as constructors (to avoid name clashes with trees later) and omits Show from any deriving clause. (We'll be implementing show ourselves.) data List a = Node a (List a) | Nil deriving (Eq)-- No deriving (Show) 2. (6 points) Mimic the missing show routine by writing a listShow x routine that returns the exact same string show x would return. (For testing purposes, add deriving ..., Show) and verify that listShow x == Show x.) You can assume that the type of x is simple in the sense that it's not a data type. (So no x :: List(List Int) values.) For Problem 2, we'll use a List type constructor modified from lecture: It uses Lnode and LNil as constructors (to avoid name clashes with trees later) and omits Show from any deriving clause. (We'll be implementing show ourselves.) data List a = Node a (List a) | Nil deriving (Eq)-- No deriving (Show) 2. (6 points) Mimic the missing show routine by writing a listShow x routine that returns the exact same string show x would return. (For testing purposes, add deriving ..., Show) and verify that listShow x == Show x.) You can assume that the type of x is simple in the sense that it's not a data type. (So no x :: List(List Int) values.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
