Safe Haskell | Safe-Infered |
---|
This module exports the type which encapsulates Factual API responses. It also provides some utility function that can be used to manipulate the Aeson object which holds the data.
Response type
A response object has a status (that will be ok if the query was successful and error if the query failed), a version (which should always be 3.0) and the actual response data which is an Aeson value.
Utility functions
fromValue :: Value -> ResponseSource
This function is used by the API module to turn the Aeson value returned by the API into a Response value.
toList :: Value -> [Value]Source
This function can be used to convert an Aeson Array value into a vanilla list.
lookupNumber :: String -> Value -> DoubleSource
This function can be used to extract a Double from an Aeson Object (HashMap) value.
lookupString :: String -> Value -> StringSource
This function can be used to extract a String from an Aeson Object (HashMap) value.
lookupValue :: String -> Value -> ValueSource
This function can be used to extract any Aeson value from an Aeson Object (HashMap) value.
lookupValueSafe :: String -> Value -> Maybe ValueSource
This function can be used to safely extract any Aeson value from an Aeson Object (HashMap) value.