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

Haskell For Problem 2, we'll use a List type constructor modified from

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

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!