Copyright | (c) 2015, Markenwerk, Jan Greve |
---|---|
License | MIT |
Maintainer | jg@markenwerk.net |
Safe Haskell | None |
Language | Haskell2010 |
- data Status
- data GoogleAnswer r = GoogleAnswer {}
- data GoogleResult = GoogleResult {
- addressComponents :: [Component]
- formattedAddress :: String
- geometry :: Geometry
- placeId :: String
- types :: [String]
- partialMatch :: Maybe Bool
- data Component = Component {}
- data Geometry = Geometry {}
- data GoogleBoundingBox = GoogleBoundingBox {}
- data Location = Location {}
- parseAnswer :: ByteString -> Either String (GoogleAnswer GoogleResult)
- getLocation :: GoogleAnswer GoogleResult -> Either String (Double, Double)
- getAddress :: GoogleAnswer GoogleResult -> Either String String
- getProperty :: GoogleAnswer r -> (r -> a) -> Either String a
- class GoogleArgumentListShow a where
- argListShow :: a -> String
Data type definition for parsed types
Represents the status of the operation returned by google. Constructors represent possible String
values
according to googles documentation.
data GoogleAnswer r Source
Represents the answer google returned.
GoogleAnswer | |
|
Functor GoogleAnswer Source | |
Foldable GoogleAnswer Source | |
Eq r => Eq (GoogleAnswer r) Source | |
Show r => Show (GoogleAnswer r) Source | |
FromJSON a => FromJSON (GoogleAnswer a) Source |
data GoogleResult Source
A single Result from the list of results from google.
GoogleResult | |
|
A part of the address in a GoogleResult
Holds geometry information about a GoogleResult
Geometry | |
|
Abstraction of a geo location
parsing
parseAnswer :: ByteString -> Either String (GoogleAnswer GoogleResult) Source
Parses a Lazy ByteString into a GoogleAnswer
or returns an error describing the problem.
convenience functions
getLocation :: GoogleAnswer GoogleResult -> Either String (Double, Double) Source
Gets the location from a GoogleAnswer
, or returns an error.
getAddress :: GoogleAnswer GoogleResult -> Either String String Source
Gets the formatted address from a GoogleAnswer (or an error)
:: GoogleAnswer r | The answer to process. |
-> (r -> a) | The function to be applied to the first (if any) result. |
-> Either String a | Error or result of the function application |
Takes a GoogleAnswer
and applies the function to the first GoogleResult
.
Returns a Left
with an error description if anything unexpected happens.
For example, getLocation
uses this with
((latitude &&& longitude) . location . geometry)
Typeclasses
class GoogleArgumentListShow a where Source
A class to format instances the way google expects them.
argListShow :: a -> String Source