Skip to content

Instantly share code, notes, and snippets.

@zenloner
Created June 5, 2013 12:42
Show Gist options
  • Save zenloner/5713580 to your computer and use it in GitHub Desktop.
Save zenloner/5713580 to your computer and use it in GitHub Desktop.
data Shape = Circle Float Float Float | Rectange Float Float Float Float
area :: Shape -> Float
area (Circle _ _ r) = pi * r^2
area (Rectange x1 y1 x2 y2) = (abs $ x2 - x1) * (abs $ y2 - y1)
main = do
print $ area (Circle 0 0 7.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment