X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTSN%2FXML%2FNews.hs;h=130323cc94544b23081e887b6c551273e71c973d;hb=7815ba497d075c63c76418fc2c2b914ebe56b712;hp=4a59859cacb770f55fb8472638f02051edbe9dd3;hpb=014b765322dd54f42c9175772f223b78c6ee8ff6;p=dead%2Fhtsn-import.git diff --git a/src/TSN/XML/News.hs b/src/TSN/XML/News.hs index 4a59859..130323c 100644 --- a/src/TSN/XML/News.hs +++ b/src/TSN/XML/News.hs @@ -58,7 +58,7 @@ import TSN.Codegen ( import TSN.DbImport ( DbImport(..), ImportResult(..), run_dbmigrate ) import TSN.Picklers ( xp_time_stamp ) import TSN.XmlImport ( XmlImport(..) ) -import Xml ( FromXml(..), pickle_unpickle, unpickleable ) +import Xml ( FromXml(..), ToDb(..), pickle_unpickle, unpickleable ) @@ -68,12 +68,15 @@ data NewsTeam = NewsTeam { team_name :: String } deriving (Eq, Show) --- | This is needed to define the XmlImport instance for NewsTeam; it --- basically says that the DB representation is the same as the XML --- representation. + +instance ToDb NewsTeam where + -- | The database representaion of a 'NewsTeam' is itself. + type Db NewsTeam = NewsTeam + +-- | This is needed to define the XmlImport instance for NewsTeam. -- instance FromXml NewsTeam where - type Db NewsTeam = NewsTeam + -- | How to we get a 'NewsTeam' from itself? from_xml = id -- | Allow us to call 'insert_xml' on the XML representation of @@ -101,12 +104,14 @@ data NewsLocation = country :: String } deriving (Eq, Show) --- | This is needed to define the XmlImport instance for NewsLocation; it --- basically says that the DB representation is the same as the XML --- representation. +instance ToDb NewsLocation where + -- | The database representation of a 'NewsLocation' is itself. + type Db NewsLocation = NewsLocation + +-- | This is needed to define the XmlImport instance for NewsLocation. -- instance FromXml NewsLocation where - type Db NewsLocation = NewsLocation + -- | How to we get a 'NewsLocation' from itself? from_xml = id -- | Allow us to call 'insert_xml' on the XML representation of @@ -173,12 +178,14 @@ data News = deriving (Data, Eq, Show, Typeable) + +instance ToDb Message where + type Db Message = News + -- | Convert the XML representation 'Message' to the database -- representation 'News'. -- instance FromXml Message where - type Db Message = News - -- | We use a record wildcard so GHC doesn't complain that we never -- used the field names. --