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.119 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.118 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.117 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.116 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.115 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.114 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.113 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.111 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.110 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.109 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.108 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.107 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.106 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.105 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.104 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.103 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.102 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.101 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.100 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
trackler-2.2.1.99 tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs