Last active
October 4, 2019 01:52
-
-
Save lumie1337/16688d6c1c5f4b741760f1a37a25d242 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
{-# LANGUAGE LambdaCase #-} | |
data Planet = Earth | Mercury | Venus | Mars | Jupiter | Saturn | Uranus | Neptune | |
deriving (Eq) | |
ageOn :: Planet -> Float -> Float | |
ageOn = flip (/) . (earthSecondsPerYear *) . earthSecondsFor | |
where | |
earthSecondsPerYear = 31557600 | |
earthSeconds = | |
\case Earth -> 1 | |
Mercury -> 0.2408467 | |
Venus -> 0.61519726 | |
Mars -> 1.8808158 | |
Jupiter -> 11.862615 | |
Saturn -> 29.447498 | |
Uranus -> 84.016846 | |
Neptune -> 164.79132 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment