- -- Insert all of this forecast's listings.
- mapM_ (insert_xml_fk_ forecast_id) (listings $ xml_league forecast)
+ -- With the forecast id in hand, loop through this forecast's
+ -- leagues...
+ forM_ (xml_leagues forecast) $ \league -> do
+ -- Construct the function that converts an XML listing to a
+ -- database one.
+ let todb = from_xml_fk_league forecast_id (league_name league)
+
+ -- Now use it to convert all of the XML listings.
+ let db_listings = map todb (listings league)
+
+ -- And finally, insert those DB listings.
+ mapM_ insert_ db_listings