Created
July 5, 2012 22:29
-
-
Save tgautier/3056889 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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