From: Michael Orlitzky Date: Fri, 2 Jan 2015 22:31:41 +0000 (-0500) Subject: Migrate TSN.XML.EarlyLine to fixed-vector-hetero. X-Git-Tag: 0.2.1~11 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=625be7f5011c1d9487b375a4cbd4486a069c42eb;p=dead%2Fhtsn-import.git Migrate TSN.XML.EarlyLine to fixed-vector-hetero. --- diff --git a/src/TSN/XML/EarlyLine.hs b/src/TSN/XML/EarlyLine.hs index 88c8634..98c5631 100644 --- a/src/TSN/XML/EarlyLine.hs +++ b/src/TSN/XML/EarlyLine.hs @@ -37,6 +37,7 @@ where 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, @@ -68,7 +69,6 @@ import Text.XML.HXT.Core ( xpWrap ) -- Local imports. -import Generics ( Generic(..), to_tuple ) import TSN.Codegen ( tsn_codegen_config ) import TSN.DbImport ( DbImport(..), ImportResult(..), run_dbmigrate ) import TSN.Picklers ( @@ -125,9 +125,9 @@ data Message = 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 @@ -189,9 +189,9 @@ data EarlyLineGameWithNote = date_game :: EarlyLineGameWithNote -> EarlyLineGameXml date_game (EarlyLineGameWithNote _ g) = g --- | For 'Generics.to_tuple'. +-- | For 'H.convert'. -- -instance Generic EarlyLineGameWithNote +instance H.HVector EarlyLineGameWithNote @@ -206,9 +206,9 @@ data EarlyLineDate = date_games_with_notes :: [EarlyLineGameWithNote] } deriving (Eq, GHC.Generic, Show) --- | For 'Generics.to_tuple'. +-- | For 'H.convert'. -- -instance Generic EarlyLineDate +instance H.HVector EarlyLineDate @@ -257,9 +257,9 @@ data EarlyLineGameXml = deriving (Eq, GHC.Generic, Show) --- | For 'Generics.to_tuple'. +-- | For 'H.convert'. -- -instance Generic EarlyLineGameXml +instance H.HVector EarlyLineGameXml -- * EarlyLineGameTeam / EarlyLineGameTeamXml @@ -480,7 +480,7 @@ mkPersist tsn_codegen_config [groundhog| 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) @@ -498,7 +498,7 @@ pickle_message = -- 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 @@ -510,7 +510,7 @@ pickle_game_with_note = 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 @@ -523,7 +523,7 @@ pickle_date = 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