X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTSN%2FXML%2FWeather.hs;h=ae79a44bd7d5c08944837b182f98af620e2fd10c;hb=a7ae66b37e8714b8f8fb3f7749c867058e9f2021;hp=3279ec81119cf16c231a9c178b1920918b881f86;hpb=5660ce1af1e19f004aaecb024ef6f9fb95b9e5c7;p=dead%2Fhtsn-import.git diff --git a/src/TSN/XML/Weather.hs b/src/TSN/XML/Weather.hs index 3279ec8..ae79a44 100644 --- a/src/TSN/XML/Weather.hs +++ b/src/TSN/XML/Weather.hs @@ -5,7 +5,7 @@ {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} --- | Parse TSN XML for the DTD "weatherxml.dtd". Each document +-- | Parse TSN XML for the DTD \"weatherxml.dtd\". Each document -- contains a bunch of forecasts, which each contain one league, and -- that league contains a bunch of listings. -- @@ -60,6 +60,8 @@ import Xml ( -- DB/XML Data types -- +-- * WeatherForecastListing/WeatherForecastListingXml + -- | XML representation of a weather forecast listing. -- data WeatherForecastListingXml = @@ -83,10 +85,13 @@ data WeatherForecastListing = instance ToDb WeatherForecastListingXml where type Db WeatherForecastListingXml = WeatherForecastListing --- | This is needed to define the XmlImport instance for --- 'WeatherForecastListing'. +-- | This is needed to define the 'XmlImportFk' instance for +-- 'WeatherForecastListing'. -- instance FromXmlFk WeatherForecastListingXml where + -- | Each 'WeatherForecastListingXml' is contained in a + -- 'WeatherForecast'. + -- type Parent WeatherForecastListingXml = WeatherForecast from_xml_fk fk WeatherForecastListingXml{..} = @@ -95,12 +100,14 @@ instance FromXmlFk WeatherForecastListingXml where db_teams = xml_teams, db_weather = xml_weather } --- | Allows us to call 'insert_xml' on the XML representation of --- WeatherForecastListing. +-- | This allows us to insert the XML representation +-- 'WeatherForecastListingXml' directly. -- instance XmlImportFk WeatherForecastListingXml +-- * WeatherLeague + -- | XML representation of a league, as they appear in the weather -- documents. There is no associated database representation because -- the league element really adds no information besides its own @@ -114,6 +121,9 @@ data WeatherLeague = listings :: [WeatherForecastListingXml] } deriving (Eq, Show) + +-- * WeatherForecast/WeatherForecastXml + -- | Database representation of a weather forecast. -- data WeatherForecast = @@ -157,6 +167,8 @@ instance FromXmlFk WeatherForecastXml where instance XmlImportFk WeatherForecastXml +-- * Weather/Message + -- | The database representation of a weather message. -- data Weather = @@ -196,12 +208,16 @@ instance FromXml Message where db_title = xml_title, db_time_stamp = xml_time_stamp } --- | This allows us to call 'insert_xml' on a 'Message' without first --- converting it to the database representation. +-- | This allows us to insert the XML representation 'Message' +-- directly. -- instance XmlImport Message +-- +-- Database stuff +-- + mkPersist tsn_codegen_config [groundhog| - entity: Weather constructors: @@ -255,6 +271,9 @@ instance DbImport Message where return ImportSucceeded +--- +--- Pickling +--- -- | Pickler to convert a 'WeatherForecastListingXml' to/from XML. --