google-maps-geocoding 0.4.0.1 → 0.4.0.2
raw patch · 3 files changed
+41/−38 lines, 3 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Web.Google.Maps.Geocoding: data Language :: *
+ Web.Google.Maps.Geocoding: data Language
- Web.Google.Maps.Geocoding: data LatLng :: *
+ Web.Google.Maps.Geocoding: data LatLng
- Web.Google.Maps.Geocoding: data Location :: *
+ Web.Google.Maps.Geocoding: data Location
- Web.Google.Maps.Geocoding: data Region :: *
+ Web.Google.Maps.Geocoding: data Region
- Web.Google.Maps.Geocoding: newtype Address :: *
+ Web.Google.Maps.Geocoding: newtype Address
- Web.Google.Maps.Geocoding: newtype Key :: *
+ Web.Google.Maps.Geocoding: newtype Key
- Web.Google.Maps.Geocoding: type GoogleMapsGeocodingAPI = ("geocode" :> ("json" :> (QueryParam "key" Key :> (QueryParam "address" Address :> (QueryParam "components" [FilterComponent] :> (QueryParam "bounds" Viewport :> (QueryParam "language" Language :> (QueryParam "region" Region :> Get '[JSON] GeocodingResponse)))))))) :<|> ("geocode" :> ("json" :> (QueryParam "key" Key :> (QueryParam "latlng" LatLng :> (QueryParam "place_id" PlaceId :> (QueryParam "result_type" AddressType :> (QueryParam "location_type" LocationType :> (QueryParam "language" Language :> Get '[JSON] GeocodingResponse))))))))
+ Web.Google.Maps.Geocoding: type GoogleMapsGeocodingAPI = "geocode" :> "json" :> QueryParam "key" Key :> QueryParam "address" Address :> QueryParam "components" [FilterComponent] :> QueryParam "bounds" Viewport :> QueryParam "language" Language :> QueryParam "region" Region :> Get '[JSON] GeocodingResponse :<|> "geocode" :> "json" :> QueryParam "key" Key :> QueryParam "latlng" LatLng :> QueryParam "place_id" PlaceId :> QueryParam "result_type" AddressType :> QueryParam "location_type" LocationType :> QueryParam "language" Language :> Get '[JSON] GeocodingResponse
Files
- changelog.md +4/−0
- google-maps-geocoding.cabal +3/−3
- src/Web/Google/Maps/Geocoding.hs +34/−35
changelog.md view
@@ -1,3 +1,7 @@+# 0.4.0.2 + +* Update dependencies for GHC 8.6.1 + # 0.4.0.1 * Update dependencies for GHC 8.4.3
google-maps-geocoding.cabal view
@@ -1,5 +1,5 @@ name: google-maps-geocoding -version: 0.4.0.1 +version: 0.4.0.2 synopsis: Google Maps Geocoding API bindings description: The <https://developers.google.com/maps/documentation/geocoding/intro Google Maps Geocoding API> provides a direct way to access geocoding and reverse @@ -28,12 +28,12 @@ library hs-source-dirs: src exposed-modules: Web.Google.Maps.Geocoding - build-depends: base >= 4.7 && < 4.12 + build-depends: base >= 4.8 && < 4.13 , aeson >= 1.1 && < 1.5 , google-static-maps >= 0.5 && < 0.6 , http-client >= 0.5 && < 0.6 , servant >= 0.11 && < 0.15 - , servant-client >= 0.11 && <0.15 + , servant-client >= 0.11 && < 0.15 , text >= 1.2 && < 1.3 default-language: Haskell2010
src/Web/Google/Maps/Geocoding.hs view
@@ -38,52 +38,51 @@ -- > import Network.HTTP.Client (Manager, newManager) -- > import Network.HTTP.Client.TLS (tlsManagerSettings) -- > import Web.Google.Maps.Geocoding (Address (..), geocode, GeocodingResponse (..), --- > Geometry (..), Key (..), LatLng (..), Result (..), Status (..)) +-- > Geometry (..), Key (..), LatLng (..), Result (..), Status (..)) -- > import Web.Google.Static.Maps (Center (..), Location (..), Size (..), --- > staticmap, Zoom (..)) +-- > staticmap, Zoom (..)) -- > import System.IO (hFlush, stdout) -- > -- > main :: IO () -- > main = do --- > putStrLn "A test of the Google Maps Geocoding API.\nNB: The use of the \ --- > \API services is subject to the Google Maps APIs Terms of Serivce at \ --- > \https://developers.google.com/maps/terms.\n" --- > txt <- input "Enter full address: " --- > mgr <- newManager tlsManagerSettings --- > let apiKey = Key "<REPLACE_THIS_WITH_YOUR_ACTUAL_GOOGLE_API_KEY>" --- > result <- geocode mgr apiKey (Just $ Address txt) Nothing Nothing --- > Nothing Nothing --- > case result of --- > Right response -> do --- > let s = status response --- > case s of --- > OK -> do --- > let latlng = location $ geometry $ head $ results --- > response --- > center = Center $ Coord latlng --- > print center --- > displayMap mgr apiKey center --- > _ -> putStrLn $ "Error! Status: " ++ show s --- > _ -> putStrLn $ "Error! Result:\n" ++ show result +-- > putStrLn $ "A test of the Google Maps Geocoding API.\nNB: The use of " ++ +-- > "the API services is subject to the Google Maps APIs Terms of " ++ +-- > "Serivce at https://developers.google.com/maps/terms.\n" +-- > txt <- input "Enter full address: " +-- > mgr <- newManager tlsManagerSettings +-- > let apiKey = Key "<REPLACE_THIS_WITH_YOUR_ACTUAL_GOOGLE_API_KEY>" +-- > result <- geocode mgr apiKey (Just $ Address txt) Nothing Nothing +-- > Nothing Nothing +-- > case result of +-- > Right response -> do +-- > let s = status response +-- > case s of +-- > OK -> do +-- > let latlng = location $ geometry $ head $ results response +-- > center = Center $ Coord latlng +-- > print center +-- > displayMap mgr apiKey center +-- > _ -> putStrLn $ "Error! Status: " ++ show s +-- > _ -> putStrLn $ "Error! Result:\n" ++ show result -- > -- > input :: Text -> IO Text -- > input msg = T.putStr msg >> hFlush stdout >> T.getLine -- > -- > displayMap :: Manager -> Key -> Center -> IO () -- > displayMap mgr apiKey center = do --- > let zoom = Just $ Zoom 17 --- > w = 400 --- > h = 400 --- > size = Size w h --- > result <- staticmap mgr apiKey Nothing (Just center) zoom size Nothing --- > Nothing [] Nothing [] [] Nothing --- > case result of --- > Right response -> do --- > let picture = fromJust $ fromDynamicImage response --- > title = "Test Google Maps Geocoding API" --- > window = InWindow title (w, h) (10, 10) --- > display window white picture --- > Left err -> putStrLn $ "Error while displaying map: " ++ show err +-- > let zoom = Just $ Zoom 17 +-- > w = 400 +-- > h = 400 +-- > size = Size w h +-- > result <- staticmap mgr apiKey Nothing (Just center) zoom size Nothing +-- > Nothing [] Nothing [] [] Nothing +-- > case result of +-- > Right response -> do +-- > let picture = fromJust $ fromDynamicImage response +-- > title = "Test Google Maps Geocoding API" +-- > window = InWindow title (w, h) (10, 10) +-- > display window white picture +-- > Left err -> putStrLn $ "Error while displaying map: " ++ show err module Web.Google.Maps.Geocoding ( -- * Functions geocode