Sha256: a1b7f4518335e9a4578798c5852e0191a9e7faf3cfbffcc769fe9280b8eb5343

Contents?: true

Size: 652 Bytes

Versions: 396

Compression:

Stored size: 652 Bytes

Contents

module SpaceAge (Planet(..), ageOn) where

data Planet = Mercury
            | Venus
            | Earth
            | Mars
            | Jupiter
            | Saturn
            | Uranus
            | Neptune

type Seconds = Double
type Years = Double

ageOn :: Planet -> Seconds -> Years
ageOn planet seconds = seconds / secondsPerYear planet

secondsPerYear :: Planet -> Seconds
secondsPerYear planet = earthYear * case planet of
  Mercury -> 0.2408467
  Venus   -> 0.61519726
  Earth   -> 1
  Mars    -> 1.8808158
  Jupiter -> 11.862615
  Saturn  -> 29.447498
  Uranus  -> 84.016846
  Neptune -> 164.79132
  where earthYear = 365.25 * 24 * 60 * 60

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.179 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.178 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.177 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.176 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.175 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.174 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.173 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.172 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.171 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.170 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.169 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.167 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.166 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.165 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.164 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.163 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.162 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.161 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.160 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs