-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bindings to the MapQuest API -- -- This library provides a high-level interface to the MapQuest API. -- Currently only the "geocoding" API (street address to coordinates) is -- provided, but the functionality is straightforward to extend. @package mapquest-api @version 0.3.1 module Web.API.MapQuest -- | 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})
--
runRequest :: (FromJSON a, Floating a) => Creds -> GeoQuery -> IO (Maybe (Coords a))
-- | The user's API credential (i.e. the MapQuest "consumer key", visible
-- at https://developer.mapquest.com/user/me/apps )
newtype Creds
Creds :: Text -> Creds
[apiKey] :: Creds -> Text
-- | Geocoding query parameters
data GeoQuery
GQ :: Text -> Text -> Text -> GeoQuery
-- | Street address (e.g. "Via Irnerio")
[gqStreet] :: GeoQuery -> Text
-- | City (e.g. "Bologna")
[gqCity] :: GeoQuery -> Text
-- | Country (e.g. "Italy")
[gqCountry] :: GeoQuery -> Text
-- | Free-text query (must be a valid address or location e.g. "Ngong Ping
-- 360, Hong Kong")
GQFree :: Text -> GeoQuery
-- | Coordinates
data Coords a
Coords :: a -> a -> Coords a
-- | Latitude
[lat] :: Coords a -> a
-- | Longitude
[long] :: Coords a -> a