import Control.Monad ( join )
import Data.Time ( UTCTime(..) )
import Data.Tuple.Curry ( uncurryN )
+import qualified Data.Vector.HFixed as H ( HVector, convert )
import Database.Groundhog (
countAll,
deleteAll,
xpWrap )
-- Local imports.
-import Generics ( Generic(..), to_tuple )
import TSN.Codegen ( tsn_codegen_config )
import TSN.DbImport ( DbImport(..), ImportResult(..), run_dbmigrate )
import TSN.Picklers (
xml_time_stamp :: UTCTime }
deriving (Eq, GHC.Generic, Show)
--- | For 'Generics.to_tuple'.
+-- | For 'H.convert'.
--
-instance Generic Message
+instance H.HVector Message
instance ToDb Message where
date_game :: EarlyLineGameWithNote -> EarlyLineGameXml
date_game (EarlyLineGameWithNote _ g) = g
--- | For 'Generics.to_tuple'.
+-- | For 'H.convert'.
--
-instance Generic EarlyLineGameWithNote
+instance H.HVector EarlyLineGameWithNote
date_games_with_notes :: [EarlyLineGameWithNote] }
deriving (Eq, GHC.Generic, Show)
--- | For 'Generics.to_tuple'.
+-- | For 'H.convert'.
--
-instance Generic EarlyLineDate
+instance H.HVector EarlyLineDate
deriving (Eq, GHC.Generic, Show)
--- | For 'Generics.to_tuple'.
+-- | For 'H.convert'.
--
-instance Generic EarlyLineGameXml
+instance H.HVector EarlyLineGameXml
-- * EarlyLineGameTeam / EarlyLineGameTeamXml
pickle_message :: PU Message
pickle_message =
xpElem "message" $
- xpWrap (from_tuple, to_tuple) $
+ xpWrap (from_tuple, H.convert) $
xp7Tuple (xpElem "XML_File_ID" xpInt)
(xpElem "heading" xpText)
(xpElem "category" xpText)
--
pickle_game_with_note :: PU EarlyLineGameWithNote
pickle_game_with_note =
- xpWrap (from_tuple, to_tuple) $
+ xpWrap (from_tuple, H.convert) $
xpPair (xpOption $ xpElem "note" xpText)
pickle_game
where
pickle_date :: PU EarlyLineDate
pickle_date =
xpElem "date" $
- xpWrap (from_tuple, to_tuple) $
+ xpWrap (from_tuple, H.convert) $
xpPair (xpAttr "value" xp_early_line_date)
(xpList pickle_game_with_note)
where
pickle_game :: PU EarlyLineGameXml
pickle_game =
xpElem "game" $
- xpWrap (from_tuple, to_tuple) $
+ xpWrap (from_tuple, H.convert) $
xp4Tuple (xpElem "time" (xpOption xp_ambiguous_time))
pickle_away_team
pickle_home_team