Copyright | (c) 2015 Devan Stormont |
---|---|
License | BSD-style |
Maintainer | stormont@gmail.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
This module defines data types for the various JSON types returned by the Forecast.io service.
These definitions are generally straight conversions from the
original JSON. Use of the Forecast.io service should return
JSON that can be directly decoded into a Forecast
object:
eitherDecode json :: Either String Forecast
Some of the ByteString
libraries seem not to parse certain unicode
characters correctly (or maybe it's an Aeson
problem; this hasn't
yet been determined). If your decoding fails, you may need to filter
out certain of these characters before decoding. In particular, the
degree symbol (Unicode character \176
) has been known to cause
decoding errors.
Another thing to be wary of is that potentially any field is not
guaranteed to be returned in the JSON. This effectively makes
every definition live within a Maybe
.
- data DataPoint = DataPoint {
- dataPoint_time :: Maybe Int
- dataPoint_summary :: Maybe Text
- dataPoint_icon :: Maybe Text
- dataPoint_sunriseTime :: Maybe Int
- dataPoint_sunsetTime :: Maybe Int
- dataPoint_moonPhase :: Maybe Double
- dataPoint_moonPhaseError :: Maybe Double
- dataPoint_nearestStormDistance :: Maybe Double
- dataPoint_nearestStormDistanceError :: Maybe Double
- dataPoint_nearestStormBearing :: Maybe Double
- dataPoint_nearestStormBearingError :: Maybe Double
- dataPoint_precipIntensity :: Maybe Double
- dataPoint_precipIntensityError :: Maybe Double
- dataPoint_precipIntensityMax :: Maybe Double
- dataPoint_precipIntensityMaxError :: Maybe Double
- dataPoint_precipIntensityMaxTime :: Maybe Int
- dataPoint_precipProbability :: Maybe Double
- dataPoint_precipProbabilityError :: Maybe Double
- dataPoint_precipType :: Maybe Text
- dataPoint_precipAccumulation :: Maybe Double
- dataPoint_precipAccumulationError :: Maybe Double
- dataPoint_temperature :: Maybe Double
- dataPoint_temperatureError :: Maybe Double
- dataPoint_temperatureMin :: Maybe Double
- dataPoint_temperatureMinError :: Maybe Double
- dataPoint_temperatureMinTime :: Maybe Int
- dataPoint_temperatureMax :: Maybe Double
- dataPoint_temperatureMaxError :: Maybe Double
- dataPoint_temperatureMaxTime :: Maybe Int
- dataPoint_apparentTemperature :: Maybe Double
- dataPoint_apparentTemperatureError :: Maybe Double
- dataPoint_apparentTemperatureMin :: Maybe Double
- dataPoint_apparentTemperatureMinError :: Maybe Double
- dataPoint_apparentTemperatureMinTime :: Maybe Int
- dataPoint_apparentTemperatureMax :: Maybe Double
- dataPoint_apparentTemperatureMaxError :: Maybe Double
- dataPoint_apparentTemperatureMaxTime :: Maybe Int
- dataPoint_dewPoint :: Maybe Double
- dataPoint_dewPointError :: Maybe Double
- dataPoint_windSpeed :: Maybe Double
- dataPoint_windSpeedError :: Maybe Double
- dataPoint_windBearing :: Maybe Double
- dataPoint_windBearingError :: Maybe Double
- dataPoint_cloudCover :: Maybe Double
- dataPoint_cloudCoverError :: Maybe Double
- dataPoint_humidity :: Maybe Double
- dataPoint_humidityError :: Maybe Double
- dataPoint_pressure :: Maybe Double
- dataPoint_pressureError :: Maybe Double
- dataPoint_visibility :: Maybe Double
- dataPoint_visibilityError :: Maybe Double
- dataPoint_ozone :: Maybe Double
- dataPoint_ozoneError :: Maybe Double
- data DataBlock = DataBlock {}
- data Alerts = Alerts {}
- data Flags = Flags {
- flags_darksky_unavailable :: Maybe Text
- flags_darksky_stations :: Maybe [Text]
- flags_datapoint_stations :: Maybe [Text]
- flags_isd_stations :: Maybe [Text]
- flags_lamp_stations :: Maybe [Text]
- flags_madis_stations :: Maybe [Text]
- flags_metar_stations :: Maybe [Text]
- flags_metno_license :: Maybe Text
- flags_sources :: Maybe [Text]
- flags_units :: Maybe Text
- data Forecast = Forecast {
- forecast_latitude :: Maybe Double
- forecast_longitude :: Maybe Double
- forecast_timezone :: Maybe Text
- forecast_offset :: Maybe Double
- forecast_currently :: Maybe DataPoint
- forecast_minutely :: Maybe DataBlock
- forecast_hourly :: Maybe DataBlock
- forecast_daily :: Maybe DataBlock
- forecast_alerts :: Maybe [Alerts]
- forecast_flags :: Maybe Flags
Documentation
Defines a single data point in the weather forecast. For a full explanation of the various records, please consult the official documentation.
Defines severe weather alerts that may be being broadcast by a variety of weather services.
Alerts | |
|
Flags
define general information about the returned data.
Flags | |
|
This is the container type for the returned data. You should be able to just directly take the downloaded JSON and transform it into this data type.