jord-2.0.0.0: Geographical Position Calculations

Copyright(c) 2020 Cedric Liegeois
LicenseBSD3
MaintainerCedric Liegeois <ofmooseandmen@yahoo.fr>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Geo.Jord.Length

Contents

Description

Types and functions for working with (signed) lengths in metres, kilometres, nautical miles or feet.

In order to use this module you should start with the following imports:

import Data.Geo.Jord.Length (Length)
import qualified Data.Geo.Jord.Length as Length
Synopsis

The Length type

data Length Source #

A length with a resolution of 1 micrometre.

Instances
Eq Length Source # 
Instance details

Defined in Data.Geo.Jord.Length

Methods

(==) :: Length -> Length -> Bool #

(/=) :: Length -> Length -> Bool #

Ord Length Source # 
Instance details

Defined in Data.Geo.Jord.Length

Read Length Source #

See length.

Instance details

Defined in Data.Geo.Jord.Length

Show Length Source #

Length is shown in metres when absolute value is <= 10 km and in kilometres otherwise.

Instance details

Defined in Data.Geo.Jord.Length

Smart constructors

feet :: Double -> Length Source #

Length from given amount of feet.

kilometres :: Double -> Length Source #

Length from given amount of kilometres.

metres :: Double -> Length Source #

Length from given amount of metres.

nauticalMiles :: Double -> Length Source #

Length from given amount of nautical miles.

Read

length :: ReadP Length Source #

Parses and returns a Length formatted as (-)float[m|km|nm|ft]. e.g. 3000m, 2.5km, -154nm or 10000ft.

read :: String -> Maybe Length Source #

Reads a Length from the given string using length.

Conversions

toFeet :: Length -> Double Source #

toFeet l converts l to feet.

toKilometres :: Length -> Double Source #

toKilometres l converts l to kilometres.

toMetres :: Length -> Double Source #

toMetres l converts l to metres.

toMillimetres :: Length -> Double Source #

toMillimetres l converts l to millimetres.

toNauticalMiles :: Length -> Double Source #

toNauticalMiles l converts l to nautical miles.

Misc

add :: Length -> Length -> Length Source #

Adds 2 lengths.

subtract :: Length -> Length -> Length Source #

Subtracts 2 lengths.

zero :: Length Source #

0 length.