From: Michael Orlitzky Date: Fri, 2 Jan 2015 22:32:15 +0000 (-0500) Subject: Migrate TSN.XML.Heartbeat to fixed-vector-hetero. X-Git-Tag: 0.2.1~10 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=b3f35d9ed5eb0c1cf5fdf3a2225083dfacd4d278;p=dead%2Fhtsn-import.git Migrate TSN.XML.Heartbeat to fixed-vector-hetero. --- diff --git a/src/TSN/XML/Heartbeat.hs b/src/TSN/XML/Heartbeat.hs index b44f930..39a2bc4 100644 --- a/src/TSN/XML/Heartbeat.hs +++ b/src/TSN/XML/Heartbeat.hs @@ -13,6 +13,7 @@ where -- System imports. import Data.Time.Clock ( UTCTime ) import Data.Tuple.Curry ( uncurryN ) +import qualified Data.Vector.HFixed as H ( HVector, convert ) import qualified GHC.Generics as GHC ( Generic ) import Test.Tasty ( TestTree, testGroup ) import Test.Tasty.HUnit ( (@?=), testCase ) @@ -27,7 +28,6 @@ import Text.XML.HXT.Core ( xpWrap ) -- Local imports. -import Generics ( Generic(..), to_tuple ) import TSN.DbImport ( ImportResult(..) ) import TSN.Picklers ( xp_time_stamp ) import Xml ( pickle_unpickle, unpickleable ) @@ -48,9 +48,9 @@ data Message = UTCTime -- time_stamp deriving (Eq, GHC.Generic, Show) --- | For 'Generics.to_tuple'. +-- | For 'H.convert'. -- -instance Generic Message +instance H.HVector Message -- | A (un)pickler that turns a Heartbeat XML file into a 'Message' @@ -59,7 +59,7 @@ instance Generic Message pickle_message :: PU Message pickle_message = xpElem "message" $ - xpWrap (from_tuple, to_tuple) $ + xpWrap (from_tuple, H.convert) $ xpTriple (xpElem "XML_File_ID" xpInt) (xpElem "heading" xpText) (xpElem "time_stamp" xp_time_stamp)