You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
685 B
20 lines
685 B
module SpaceAge (Planet(..), ageOn) where |
|
|
|
data Planet = Mercury |
|
| Venus |
|
| Earth |
|
| Mars |
|
| Jupiter |
|
| Saturn |
|
| Uranus |
|
| Neptune |
|
|
|
ageOn :: Planet -> Float -> Float |
|
ageOn Earth seconds = seconds / 60 / 60 / 24 / 365.25 |
|
ageOn Mercury seconds = ageOn Earth seconds / 0.2408467 |
|
ageOn Venus seconds = ageOn Earth seconds / 0.61519726 |
|
ageOn Mars seconds = ageOn Earth seconds / 1.8808158 |
|
ageOn Jupiter seconds = ageOn Earth seconds / 11.862615 |
|
ageOn Saturn seconds = ageOn Earth seconds / 29.447498 |
|
ageOn Uranus seconds = ageOn Earth seconds / 84.016846 |
|
ageOn Neptune seconds = ageOn Earth seconds / 164.79132
|
|
|