mapquest-api-0.3.1: Bindings to the MapQuest API

Copyright(c) Marco Zocca 2018
LicenseGPL-3
Maintainerzocca.marco gmail
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Web.API.MapQuest

Contents

Description

 

Synopsis

Geocoding

Running requests

runRequest Source #

Arguments

:: (FromJSON a, Floating a) 
=> Creds

API key (available for free on https://developer.mapquest.com)

-> GeoQuery

Location to be queried

-> IO (Maybe (Coords a)) 

Call the MapQuest Geocoding API with a given address and extract the coordinates from the parsed result.

Example usage : assuming the user has bound key to hold the API key string, the following can be run in a GHCi shell :

>>> runRequest key (GQ "Via Irnerio" "Bologna" "Italy")
Just (Coords {lat = 44.49897, long = 11.34503})
>>> runRequest key (GQFree "Ngong Ping 360, Hong Kong")
Just (Coords {lat = 22.264412, long = 114.16706})

Parameters

newtype Creds Source #

The user's API credential (i.e. the MapQuest "consumer key", visible at https://developer.mapquest.com/user/me/apps )

Constructors

Creds 

Fields

Instances

Eq Creds Source # 

Methods

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

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

Show Creds Source # 

Methods

showsPrec :: Int -> Creds -> ShowS #

show :: Creds -> String #

showList :: [Creds] -> ShowS #

data GeoQuery Source #

Geocoding query parameters

Constructors

GQ 

Fields

GQFree Text

Free-text query (must be a valid address or location e.g. "Ngong Ping 360, Hong Kong")

Output

data Coords a Source #

Coordinates

Constructors

Coords 

Fields

Instances

Eq a => Eq (Coords a) Source # 

Methods

(==) :: Coords a -> Coords a -> Bool #

(/=) :: Coords a -> Coords a -> Bool #

Show a => Show (Coords a) Source # 

Methods

showsPrec :: Int -> Coords a -> ShowS #

show :: Coords a -> String #

showList :: [Coords a] -> ShowS #

Generic (Coords a) Source # 

Associated Types

type Rep (Coords a) :: * -> * #

Methods

from :: Coords a -> Rep (Coords a) x #

to :: Rep (Coords a) x -> Coords a #

type Rep (Coords a) Source # 
type Rep (Coords a) = D1 * (MetaData "Coords" "Web.API.MapQuest.Geocoding" "mapquest-api-0.3.1-54kM5aQ6JQq4hxpDXL9gn5" False) (C1 * (MetaCons "Coords" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "lat") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * a)) (S1 * (MetaSel (Just Symbol "long") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * a))))