astro-0.4.2.1: Amateur astronomical computations

CopyrightAlexander Ignatyev 2016
Safe HaskellSafe
LanguageHaskell2010

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

Documentation

newtype DecimalDegrees #

Constructors

DD Double 

Instances

Eq DecimalDegrees # 
Fractional DecimalDegrees # 
Num DecimalDegrees # 
Ord DecimalDegrees # 
Real DecimalDegrees # 
RealFrac DecimalDegrees # 
Show DecimalDegrees # 

newtype DecimalHours #

Constructors

DH Double 

newtype AstronomicalUnits #

Astronomical Units, 1AU = 1.4960×1011 m (originally, the average distance of Earth's aphelion and perihelion).

Constructors

AU Double 

Instances

Eq AstronomicalUnits # 
Fractional AstronomicalUnits # 
Num AstronomicalUnits # 
Ord AstronomicalUnits # 
Real AstronomicalUnits # 
RealFrac AstronomicalUnits # 
Show AstronomicalUnits # 

lightTravelTime :: AstronomicalUnits -> DecimalHours #

Light travel time of the distance in Astronomical Units

kmToAU :: Double -> AstronomicalUnits #

Convert from kilometers to Astronomical Units

auToKM :: AstronomicalUnits -> Double #

Comvert from Astronomical Units to kilometers

toDecimalHours :: DecimalDegrees -> DecimalHours #

Convert decimal degrees to decimal hours

fromDecimalHours :: DecimalHours -> DecimalDegrees #

Convert decimal hours to decimal degrees

toRadians :: DecimalDegrees -> Double #

Convert from DecimalDegrees to Radians

fromRadians :: Double -> DecimalDegrees #

Convert from Radians to DecimalDegrees

fromDMS :: RealFrac a => Int -> Int -> a -> DecimalDegrees #

Convert Degrees, Minutes, Seconds to DecimalDegrees

toDMS :: (Integral b, Integral a) => DecimalDegrees -> (a, b, Double) #

Convert DecimalDegrees to Degrees, Minutes, Seconds

fromHMS :: RealFrac a => Int -> Int -> a -> DecimalHours #

Comvert Hours, Minutes, Seconds to DecimalHours

toHMS :: (Integral b, Integral a) => DecimalHours -> (a, b, Double) #

Convert DecimalDegrees to Degrees, Minutes, Seconds