Copyright | Alexander Ignatyev 2016 |
---|---|
Safe Haskell | Safe |
Language | Haskell2010 |
Data.Astro.Types
Description
Common Types are usfull across all subsystems like Time and Coordinate.
Examples
Decimal hours and Decimal degrees
import Data.Astro.Types -- 10h 15m 19.7s dh :: DecimalHours dh = fromHMS 10 15 19.7 -- DH 10.255472222222222 (h, m, s) = toHMS dh -- (10,15,19.699999999999562) -- 51°28′40″ dd :: DecimalDegrees dd = fromDMS 51 28 40 -- DD 51.477777777777774 (d, m, s) = toDMS dd -- (51,28,39.999999999987494)
Geographic Coordinates
import Data.Astro.Types -- the Royal Observatory, Greenwich ro :: GeographicCoordinates ro = GeoC (fromDMS 51 28 40) (-(fromDMS 0 0 5)) -- GeoC {geoLatitude = DD 51.4778, geoLongitude = DD (-0.0014)}
Synopsis
- newtype DecimalDegrees = DD Double
- newtype DecimalHours = DH Double
- data GeographicCoordinates = GeoC {}
- newtype AstronomicalUnits = AU Double
- lightTravelTime :: AstronomicalUnits -> DecimalHours
- kmToAU :: Double -> AstronomicalUnits
- auToKM :: AstronomicalUnits -> Double
- toDecimalHours :: DecimalDegrees -> DecimalHours
- fromDecimalHours :: DecimalHours -> DecimalDegrees
- toRadians :: DecimalDegrees -> Double
- fromRadians :: Double -> DecimalDegrees
- fromDMS :: RealFrac a => Int -> Int -> a -> DecimalDegrees
- toDMS :: (Integral a, Integral b) => DecimalDegrees -> (a, b, Double)
- fromHMS :: RealFrac a => Int -> Int -> a -> DecimalHours
- toHMS :: (Integral a, Integral b) => DecimalHours -> (a, b, Double)
Documentation
newtype DecimalDegrees Source #
Instances
newtype DecimalHours Source #
Instances
data GeographicCoordinates Source #
Geographic Coordinates
Constructors
GeoC | |
Fields |
Instances
Eq GeographicCoordinates Source # | |
Defined in Data.Astro.Types Methods (==) :: GeographicCoordinates -> GeographicCoordinates -> Bool # (/=) :: GeographicCoordinates -> GeographicCoordinates -> Bool # | |
Show GeographicCoordinates Source # | |
Defined in Data.Astro.Types Methods showsPrec :: Int -> GeographicCoordinates -> ShowS # show :: GeographicCoordinates -> String # showList :: [GeographicCoordinates] -> ShowS # |
newtype AstronomicalUnits Source #
Astronomical Units, 1AU = 1.4960×1011 m (originally, the average distance of Earth's aphelion and perihelion).
Instances
lightTravelTime :: AstronomicalUnits -> DecimalHours Source #
Light travel time of the distance in Astronomical Units
kmToAU :: Double -> AstronomicalUnits Source #
Convert from kilometers to Astronomical Units
auToKM :: AstronomicalUnits -> Double Source #
Comvert from Astronomical Units to kilometers
toDecimalHours :: DecimalDegrees -> DecimalHours Source #
Convert decimal degrees to decimal hours
fromDecimalHours :: DecimalHours -> DecimalDegrees Source #
Convert decimal hours to decimal degrees
toRadians :: DecimalDegrees -> Double Source #
Convert from DecimalDegrees to Radians
fromRadians :: Double -> DecimalDegrees Source #
Convert from Radians to DecimalDegrees
fromDMS :: RealFrac a => Int -> Int -> a -> DecimalDegrees Source #
Convert Degrees, Minutes, Seconds to DecimalDegrees
toDMS :: (Integral a, Integral b) => DecimalDegrees -> (a, b, Double) Source #
Convert DecimalDegrees to Degrees, Minutes, Seconds