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 )
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
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
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.
--