-- read http://learnyouahaskell.com/making-our-own-types-and-typeclasses data Shape = Circle Float Float Float | Rectangle Float Float Float Float --data Shape = Circle Float Float Float | Rectangle Float Float Float Float deriving (Show) surface (Circle _ _ r) = pi * r ^ 2 surface (Rectangle x1 y1 x2 y2) = (abs $ x2 - x1) * (abs $ y2 - y1) -- :s +t -- :t Circle -- surface (Circle 1 2 3) -- surface ( Rectangle 1 2 3 4) -- Circle 1 2 3 -- map (Circle 10 20) [4,5,6,6]