]> gitweb.michael.orlitzky.com - dead/htsn-import.git/commitdiff
Use Generics.prepend in TSN.XML.AutoRacingDriverList.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 2 Jan 2015 17:55:57 +0000 (12:55 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 2 Jan 2015 17:55:57 +0000 (12:55 -0500)
src/TSN/XML/AutoRacingDriverList.hs

index b1a611e77133087271c2a380160d546071c6c881..9d9e090a662fe96da230e8ff9d57422c6597d307 100644 (file)
@@ -52,7 +52,7 @@ import Text.XML.HXT.Core (
   xpWrap )
 
 -- Local imports.
-import Generics ( Generic(..), to_tuple )
+import Generics ( Generic(..), prepend, to_tuple )
 import TSN.Codegen ( tsn_codegen_config )
 import TSN.DbImport ( DbImport(..), ImportResult(..), run_dbmigrate )
 import TSN.Picklers ( xp_date, xp_time_stamp )
@@ -157,6 +157,12 @@ data AutoRacingDriverListListing =
     db_nationality :: Maybe String,
     db_car_number :: Int,
     db_car :: String }
+  deriving ( GHC.Generic )
+
+-- | For 'Generics.prepend'.
+--
+instance Generic AutoRacingDriverListListing
+
 
 -- | XML representation of a \<Listing\> contained within a
 --   \<message\>.
@@ -197,18 +203,8 @@ instance FromXmlFk AutoRacingDriverListListingXml where
   --   'AutoRacingDriverListListing', we add the foreign key and copy
   --   everything else verbatim.
   --
-  from_xml_fk fk AutoRacingDriverListListingXml{..} =
-    AutoRacingDriverListListing {
-      db_auto_racing_driver_lists_id = fk,
-      db_driver_id = xml_driver_id,
-      db_driver = xml_driver,
-      db_height = xml_height,
-      db_weight = xml_weight,
-      db_date_of_birth = xml_date_of_birth,
-      db_hometown = xml_hometown,
-      db_nationality = xml_nationality,
-      db_car_number = xml_car_number,
-      db_car = xml_car }
+  from_xml_fk = prepend
+
 
 
 -- | This allows us to insert the XML representation