Question: Plz help!!! Write function in haskell. Thank you!! reorder is a single function that can either reorder or sort. Since the two functions need different

Plz help!!! Write function in haskell. Thank you!!

reorder is a single function that can either reorder or sort. Since the two functions need different types of parameters, you are to define a new data type that can have either one. Thus, reorder is to take two parameters: the first is to be a new data type called Choose and the second is an orderable list. Choose is to be defined as either a Sort or a Permute. Sort is a single character and Permute is a list of integers. If Choose is a Sort, the orderable list is to be processed in the same way as it would be processed with the Sort value passed to osort. If Choose is a Permute, the list is to processed as if the two lists were passed to permute. That is,

reorder (Sort 'f') [9,3,6,2] should produce the same result as osort 'f' [9,3,6,2]

and

reorder (Permute [2,1,3]) [9,3,6,2] the same as permute [2,1,3] [9,3,6,2]

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!