Copyright | (c) 2020 Cedric Liegeois |
---|---|
License | BSD3 |
Maintainer | Cedric Liegeois <ofmooseandmen@yahoo.fr> |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Types and functions for working with speed in metres per second, kilometres per hour, miles per hour, knots or feet per second.
Synopsis
- data Speed
- averageSpeed :: Length -> Duration -> Speed
- metresPerSecond :: Double -> Speed
- kilometresPerHour :: Double -> Speed
- milesPerHour :: Double -> Speed
- knots :: Double -> Speed
- feetPerSecond :: Double -> Speed
- speedP :: ReadP Speed
- readSpeed :: String -> Maybe Speed
- toMetresPerSecond :: Speed -> Double
- toKilometresPerHour :: Speed -> Double
- toMilesPerHour :: Speed -> Double
- toKnots :: Speed -> Double
- toFeetPerSecond :: Speed -> Double
The Speed
type
A speed with a resolution of 1 millimetre per hour.
Smart constructors
Read
speedP :: ReadP Speed Source #
Parses and returns a Speed
formatted as (-)float[ms|kmh|mph|kt].
e.g. 300ms, 250kmh, -154mph, 400kt or 100ft/s.
Conversions
toMetresPerSecond :: Speed -> Double Source #
toMetresPerSecond s
converts s
to metres per second.
toKilometresPerHour :: Speed -> Double Source #
toKilometresPerHour s
converts s
to kilometres per hour.
toMilesPerHour :: Speed -> Double Source #
toMilesPerHour s
converts s
to miles per hour.
toFeetPerSecond :: Speed -> Double Source #
toFeetPerSecond s
converts s
to feet per second.