module Shapes
(	Point(..)
	, Shape(..)
	,surface
	,nudge
	,baseCircle
	,baseRect


) where 
data Point = Point Float Float deriving (Show)

data Shape = Circle Point  Float | Rectangle Point Point deriving (Show)

surface:: Shape -> Float
surface(Circle _ r) = pi * r ^ 2
surface(Rectangle (Point x1 y1) (Point x2 y2)) = (abs $ y2 - y1) * (abs $ x2 - x1)

-- a function that moves the shape from initial coordinates 
nudge:: Shape -> Float -> Float -> Shape
nudge (Circle (Point x y) r) a b = Circle (Point (x+a) (y+b)) r
nudge (Rectangle (Point x1 y1) (Point x2 y2)) a b= Rectangle(Point (x1+a) (y1+b)) (Point (x2+a) (y2+b))

-- add functions that creates shapes of some size at the origin and nudge them appropriately
baseCircle :: Float -> Shape
baseCircle r = Circle (Point 0 0) r

baseRect :: Float -> Float -> Shape
baseRect width height = Rectangle (Point 0 0) (Point width height)