NOTE: This question is about CodeWorld Haskell (http://code.world/haskell).
Line has already been defined as a constructor for Shape. I am supposed to make a function that converts a Line given two points into a picture using pattern matching. I have to then enter an expression into my Haskell compiler:
and this will give me a picture of a line from the coordinates.
drawingOf (shapeToPic (Line (0, 0) (1, 1)))
data Shape = Line Point Point
My thinking is like
where i have to somehow define the line as points.
shapeToPicture :: Shape -> Picture
shapeToPicture = polyline(Line)
Then I'm confused with do i have to redefine line? like
myLine :: Point -> Point -> Shape
myLine a b c d = (a,b), (c, d)
I have confused my self too much.
Any help will be greatly appreciated.