module SpaceAge (Planet(..), ageOn) where
data Planet = Mercury
| Venus
| Earth
| Mars
| Jupiter
| Saturn
| Uranus
| Neptune
deriving (Show, Eq)
ageOn :: Planet -> Float -> Float
ageOn planet seconds
| planet == Mercury = 0.2408467 * earthAge
| planet == Venus = 0.61519726 * earthAge
| planet == Earth = seconds * 31557600
| planet == Mars = 1.8808158 * earthAge
| planet == Jupiter = 11.862615 * earthAge
| planet == Saturn = 29.447498 * earthAge
| planet == Uranus = 84.016846 * earthAge
| planet == Neptune = 164.79132 * earthAge
where earthAge = ageOn Earth seconds