Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module captures position of a point on the globe.
- data Geo = Geo !Latitude !Longitude
- northPole :: Geo
- southPole :: Geo
- data Latitude
- north :: Angle -> Latitude
- south :: Angle -> Latitude
- lat :: Angle -> Latitude
- equator :: Latitude
- tropicOfCancer :: Latitude
- tropicOfCapricon :: Latitude
- data Longitude
- east :: Angle -> Longitude
- west :: Angle -> Longitude
- lon :: Angle -> Longitude
- greenwich :: Longitude
Basics
A point on the globe is specified by giving its geo coordinates
captures by the type Geo
. It is essentially a pair of the
Latitude
and Longitude
of the point.
Examples
kanpurLatitude :: Latitude kanpurLatitude = lat $ degree 26.4477777 kanpurLongitude :: Longitude kanpurLongitude = lon $ degree 80.3461111
kanpurLatitude = lat $ degree 26 <> minute 26 <> second 52 kanpurLongitude = lon $ degree 80 <> minute 20 <> second 46
The show and read instance of the Latitude
and Longitude
types
uses degrees for displaying and reading respectively. Show and Read
instances can express these quantities up to Nano degree precision.
Convention on sign.
For latitudes, positive means north and negative means south. For
longitudes, positive means east and negative means west. However,
if you find these conventions confusing you can use the combinators
north
, south
, east
, and west
when constructing latitudes or
longitudes.
The coordinates of a point on the earth's surface.
Latitudes
The latitude of a point. Positive denotes North of Equator where as negative South.
north :: Angle -> Latitude Source #
Convert an angle to a northern latitude
tropicOfCancer = north $ degree 23.5
south :: Angle -> Latitude Source #
Convert an angle to a southern latitude.
tropicOfCapricon = south $ degree 23.5
tropicOfCancer :: Latitude Source #
The latitude corresponding to the Tropic of Cancer.
tropicOfCapricon :: Latitude Source #
The latitude corresponding to the Tropic of Capricon
Longitudes.
The longitude of a point. Positive denotes East of the Greenwich meridian where as negative denotes West.
east :: Angle -> Longitude Source #
Convert angle to an eastern longitude.
kanpurLongitude = east $ degree 80.3461