2016-05-13 02:26:52 +00:00
|
|
|
module SpaceAge exposing (..)
|
2016-03-17 01:36:23 +00:00
|
|
|
|
|
|
|
|
2016-03-17 01:38:51 +00:00
|
|
|
type Planet
|
2016-06-19 21:46:13 +00:00
|
|
|
= Mercury
|
|
|
|
| Venus
|
|
|
|
| Earth
|
|
|
|
| Mars
|
|
|
|
| Jupiter
|
|
|
|
| Saturn
|
|
|
|
| Uranus
|
|
|
|
| Neptune
|
2016-03-17 01:38:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
earthYearInSeconds =
|
2016-06-19 21:46:13 +00:00
|
|
|
365.25 * 24 * 60 * 60
|
2016-03-17 01:36:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
ageOn : Planet -> Float -> Float
|
2016-03-17 01:38:51 +00:00
|
|
|
ageOn planet seconds =
|
2016-06-19 21:46:13 +00:00
|
|
|
seconds / (secondsPerYear planet)
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2016-03-17 01:36:23 +00:00
|
|
|
|
|
|
|
secondsPerYear : Planet -> Float
|
|
|
|
secondsPerYear planet =
|
2016-06-19 21:46:13 +00:00
|
|
|
earthYearInSeconds
|
|
|
|
* case planet of
|
|
|
|
Mercury ->
|
|
|
|
0.2408467
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2016-06-19 21:46:13 +00:00
|
|
|
Venus ->
|
|
|
|
0.61519726
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2016-06-19 21:46:13 +00:00
|
|
|
Earth ->
|
|
|
|
1
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2016-06-19 21:46:13 +00:00
|
|
|
Mars ->
|
|
|
|
1.8808158
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2016-06-19 21:46:13 +00:00
|
|
|
Jupiter ->
|
|
|
|
11.862615
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2016-06-19 21:46:13 +00:00
|
|
|
Saturn ->
|
|
|
|
29.447498
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2016-06-19 21:46:13 +00:00
|
|
|
Uranus ->
|
|
|
|
84.016846
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2016-06-19 21:46:13 +00:00
|
|
|
Neptune ->
|
|
|
|
164.79132
|