X-Git-Url: https://gitweb.michael.orlitzky.com/?p=dead%2Fhtsn-import.git;a=blobdiff_plain;f=src%2FTSN%2FXML%2FAutoRacingDriverList.hs;h=9d9e090a662fe96da230e8ff9d57422c6597d307;hp=b1a611e77133087271c2a380160d546071c6c881;hb=1f04fd8786215141dad63099dc6f48d17b7ac96c;hpb=dc53ce490d36c937a8db674e6fd3e9495247dc8b diff --git a/src/TSN/XML/AutoRacingDriverList.hs b/src/TSN/XML/AutoRacingDriverList.hs index b1a611e..9d9e090 100644 --- a/src/TSN/XML/AutoRacingDriverList.hs +++ b/src/TSN/XML/AutoRacingDriverList.hs @@ -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 \ contained within a -- \. @@ -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