Question: This is a Haskell question. Please provide the definitions for the functions in Haskell! Here is the definition of a data type for representing a

This is a Haskell question. Please provide the definitions for the functions in Haskell!

This is a Haskell question. Please provide the definitions for the functions

in Haskell! Here is the definition of a data type for representing

Here is the definition of a data type for representing a few basic shapes. A figure is a collection of shapes. The type BBox represents bounding boxes of objects by the points of the lower-left and upper-right hand corners of the smallest enclosing rectangle. (a) Define the function width that computes the width of a shape. width::ShapeLength For example, the widths of the shapes in the figure f are as follows. f=[Pt(4,4),Circle(5,5)3,Rect(3,3)72]>mapwidthf[0,6,7] (b) Define the function bbox that computes the bounding box of a shape. bbox::ShapeBBox The bounding boxes of the shapes in the figure f are as follows. >mapbboxf[((4,4),(4,4)),((2,2),(8,8)),((3,3),(10,5))] (c) Define the function minx that computes the minimum x coordinate of a shape. minX::ShapeNumber The minimum x coordinates of the shapes in the figure f are as follows. >mapminxf[4,2,3] (d) Define a function move that moves the position of a shape by a vector given by a point as its second argument. move::ShapePointShape It is probably a good idea to define and use an auxiliary function addPt :: Point Point Point, which adds two points component wise

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!