xml_game_date :: UTCTime,
xml_game_time :: Maybe UTCTime,
xml_location :: Maybe String,
- xml_away_team :: ScheduleChangesListingAwayTeamXml,
- xml_home_team :: ScheduleChangesListingHomeTeamXml,
+ xml_away_team :: ScheduleChangesListingTeamXml,
+ xml_home_team :: ScheduleChangesListingTeamXml,
xml_vscore :: Int,
xml_hscore :: Int,
xml_listing_status :: ScheduleChangesListingStatus,
--- * ScheduleChangesListingAwayTeamXml / ScheduleChangesListingHomeTeamXml
+-- * ScheduleChangesListingTeamXml
--- | The XML representation of a 'ScheduleChangesListing' away
+-- | The XML representation of a 'ScheduleChangesListing'
-- team. Its corresponding database representation (along with that
-- of the home team) is a "TSN.Team", but their XML representations
--- are different.
+-- are slightly different.
--
-data ScheduleChangesListingAwayTeamXml =
- ScheduleChangesListingAwayTeamXml {
- away_team_id :: String,
- away_team_name :: Maybe String }
+data ScheduleChangesListingTeamXml =
+ ScheduleChangesListingTeamXml {
+ xml_team_id :: String,
+ xml_team_name :: Maybe String }
deriving (Eq, Show)
-instance ToDb ScheduleChangesListingAwayTeamXml where
- -- | The database analogue of an 'ScheduleChangesListingAwayTeamXml' is
+instance ToDb ScheduleChangesListingTeamXml where
+ -- | The database analogue of an 'ScheduleChangesListingTeamXml' is
-- a 'Team'.
--
- type Db ScheduleChangesListingAwayTeamXml = Team
+ type Db ScheduleChangesListingTeamXml = Team
-instance FromXml ScheduleChangesListingAwayTeamXml where
- -- | To convert a 'ScheduleChangesListingAwayTeamXml' to a 'Team',
+instance FromXml ScheduleChangesListingTeamXml where
+ -- | To convert a 'ScheduleChangesListingTeamXml' to a 'Team',
-- we set the non-existent abbreviation to \"Nothing\".
--
- from_xml ScheduleChangesListingAwayTeamXml{..} =
+ from_xml ScheduleChangesListingTeamXml{..} =
Team {
- team_id = away_team_id,
+ team_id = xml_team_id,
abbreviation = Nothing,
- name = away_team_name }
+ name = xml_team_name }
--- | Allow us to import ScheduleChangesListingAwayTeamXml directly.
+-- | Allow us to import ScheduleChangesListingTeamXml directly.
--
-instance XmlImport ScheduleChangesListingAwayTeamXml
+instance XmlImport ScheduleChangesListingTeamXml
--- | The XML representation of a 'ScheduleChangesListing' home
--- team. Its corresponding database representation (along with that
--- of the away team) is a "TSN.Team", but their XML representations
--- are different.
---
-data ScheduleChangesListingHomeTeamXml =
- ScheduleChangesListingHomeTeamXml {
- home_team_id :: String,
- home_team_name :: Maybe String }
- deriving (Eq, Show)
-
-
-instance ToDb ScheduleChangesListingHomeTeamXml where
- -- | The database analogue of an 'ScheduleChangesListingHomeTeamXml'
- -- is a 'Team'.
- --
- type Db ScheduleChangesListingHomeTeamXml = Team
-
-
-instance FromXml ScheduleChangesListingHomeTeamXml where
- -- | To convert a 'ScheduleChangesListingHomeTeamXml' to a 'Team',
- -- we set the non-existent abbreviation to \"Nothing\".
- --
- from_xml ScheduleChangesListingHomeTeamXml{..} =
- Team {
- team_id = home_team_id,
- abbreviation = Nothing,
- name = home_team_name }
-
-
--- | Allow us to import ScheduleChangesListingHomeTeamXml directly.
---
-instance XmlImport ScheduleChangesListingHomeTeamXml
-
--
-- * Database stuff.
-- | An (un)pickler for the \<Away_Team\> elements.
--
-pickle_away_team :: PU ScheduleChangesListingAwayTeamXml
+pickle_away_team :: PU ScheduleChangesListingTeamXml
pickle_away_team =
xpElem "Away_Team" $
xpWrap (from_tuple, to_tuple) $
xpPair (xpAttr "AT_ID" xpText)
(xpOption xpText)
where
- from_tuple = uncurry ScheduleChangesListingAwayTeamXml
- to_tuple t = (away_team_id t,
- away_team_name t)
+ from_tuple = uncurry ScheduleChangesListingTeamXml
+ to_tuple t = (xml_team_id t,
+ xml_team_name t)
--- | An (un)pickler for the \<Home_Team\> elements.
+-- | An (un)pickler for the \<Away_Team\> elements.
--
-pickle_home_team :: PU ScheduleChangesListingHomeTeamXml
+pickle_home_team :: PU ScheduleChangesListingTeamXml
pickle_home_team =
xpElem "Home_Team" $
xpWrap (from_tuple, to_tuple) $
xpPair (xpAttr "HT_ID" xpText)
(xpOption xpText)
where
- from_tuple = uncurry ScheduleChangesListingHomeTeamXml
- to_tuple t = (home_team_id t,
- home_team_name t)
+ from_tuple = uncurry ScheduleChangesListingTeamXml
+ to_tuple t = (xml_team_id t,
+ xml_team_name t)
-- | An (un)pickler for the \<status\> elements.