Skip to content

Instantly share code, notes, and snippets.

@tgautier
Created July 5, 2012 22:29
Show Gist options
  • Save tgautier/3056889 to your computer and use it in GitHub Desktop.
Save tgautier/3056889 to your computer and use it in GitHub Desktop.
module Main where
type Radius = Double
type Side = Double
data Shape =
Point
| Circle Radius
| Rectangle Side Side
| Square Side
area Point
area (Circle r) =pi*r*r area (Rectangle w h) = w * h
area (Square s) =s*s
rev [] = []
rev (x:xs) = rev xs ++ [x]
main = do
print (area Point)
print (area (Circle 10))
print (area (Rectangle 20 343535))
print (area (Square 20))
print (rev [42, 55, 10, 20])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment