Skip to content

Instantly share code, notes, and snippets.

@dmjio
Last active July 16, 2021 04:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmjio/553bfca04ffb25efa893d4a4950ede6e to your computer and use it in GitHub Desktop.
Save dmjio/553bfca04ffb25efa893d4a4950ede6e to your computer and use it in GitHub Desktop.
module SpaceAge
( Planet (..)
, ageOn
) where
data Planet
= Mercury
| Venus
| Earth
| Mars
| Jupiter
| Saturn
| Uranus
| Neptune
ageOn
:: Planet
-> Float
-> Float
ageOn Earth seconds = seconds / 31557600
ageOn Venus seconds = ageOn Earth seconds / 0.61519726
ageOn Mercury seconds = ageOn Earth seconds / 0.2408467
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment