X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTSN%2FXML%2FWeather.hs;h=be591c10276d76570fa4f29a8fdc34de7cfbd714;hb=b0a87f9323223a0af538184940b35a081f5763af;hp=bda29ee2541005efb4ca1eaedcccf77d1231d201;hpb=1313369f569e4a1eecd96a4ac09f533e940d02fa;p=dead%2Fhtsn-import.git diff --git a/src/TSN/XML/Weather.hs b/src/TSN/XML/Weather.hs index bda29ee..be591c1 100644 --- a/src/TSN/XML/Weather.hs +++ b/src/TSN/XML/Weather.hs @@ -57,6 +57,7 @@ import TSN.DbImport ( DbImport(..), ImportResult(..), run_dbmigrate ) import TSN.Picklers ( xp_gamedate, xp_time_stamp ) import TSN.XmlImport ( XmlImport(..), XmlImportFk(..) ) import Xml ( + Child(..), FromXml(..), FromXmlFk(..), ToDb(..), @@ -101,15 +102,18 @@ data WeatherForecastListing = instance ToDb WeatherForecastListingXml where type Db WeatherForecastListingXml = WeatherForecastListing --- | This is needed to define the 'XmlImportFk' instance for --- 'WeatherForecastListing'. --- -instance FromXmlFk WeatherForecastListingXml where + +instance Child WeatherForecastListingXml where -- | Each 'WeatherForecastListingXml' is contained in a -- 'WeatherForecast'. -- type Parent WeatherForecastListingXml = WeatherForecast + +-- | This is needed to define the 'XmlImportFk' instance for +-- 'WeatherForecastListing'. +-- +instance FromXmlFk WeatherForecastListingXml where from_xml_fk fk WeatherForecastListingXml{..} = WeatherForecastListing { db_weather_forecasts_id = fk, @@ -164,9 +168,15 @@ instance ToDb WeatherForecastXml where -- type Db WeatherForecastXml = WeatherForecast -instance FromXmlFk WeatherForecastXml where + +instance Child WeatherForecastXml where + -- | The database type containing a 'WeatherForecastXml' is + -- 'Weather'. type Parent WeatherForecastXml = Weather + +instance FromXmlFk WeatherForecastXml where + -- | To convert a 'WeatherForecastXml' into a 'WeatherForecast', we -- replace the 'WeatherLeague' with its name. --