From: Michael Orlitzky Date: Sun, 6 Jul 2014 20:15:40 +0000 (-0400) Subject: Fix hlint warnings. X-Git-Tag: 0.0.6~9 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=14dc52a2e7d7712281aee2332f7342f67abe4306;p=dead%2Fhtsn-import.git Fix hlint warnings. --- diff --git a/src/TSN/XML/AutoRacingResults.hs b/src/TSN/XML/AutoRacingResults.hs index a32d704..f917725 100644 --- a/src/TSN/XML/AutoRacingResults.hs +++ b/src/TSN/XML/AutoRacingResults.hs @@ -370,8 +370,7 @@ instance DbImport Message where insert_xml_fk_ msg_id (xml_race_information m) - forM_ (xml_listings m) $ \listing -> do - insert_xml_fk_ msg_id listing + forM_ (xml_listings m) $ insert_xml_fk_ msg_id return ImportSucceeded @@ -398,9 +397,9 @@ mkPersist tsn_codegen_config [groundhog| reference: onDelete: cascade -# Note the apostrophe in the foreign key. This is to disambiguate -# it from the AutoRacingResultsListing foreign key of the same name. -# We strip it out of the dbName. + # Note the apostrophe in the foreign key. This is to disambiguate + # it from the AutoRacingResultsListing foreign key of the same name. + # We strip it out of the dbName. - entity: AutoRacingResultsRaceInformation dbName: auto_racing_results_race_information constructors: diff --git a/src/TSN/XML/GameInfo.hs b/src/TSN/XML/GameInfo.hs index bc68f42..4f264bb 100644 --- a/src/TSN/XML/GameInfo.hs +++ b/src/TSN/XML/GameInfo.hs @@ -204,7 +204,7 @@ test_dbimport_succeeds = testCase "dbimport succeeds" $ do xmltrees <- mapM unsafe_read_document game_info_test_files let msgs = rights $ map (parse_xml "dummy") xmltrees actual <- withSqliteConn ":memory:" $ runDbConn $ do - runMigration silentMigrationLogger $ do + runMigration silentMigrationLogger $ migrate (undefined :: GameInfo) mapM_ dbimport msgs countAll (undefined :: GameInfo) diff --git a/src/TSN/XML/JFile.hs b/src/TSN/XML/JFile.hs index 3576816..6766374 100644 --- a/src/TSN/XML/JFile.hs +++ b/src/TSN/XML/JFile.hs @@ -353,8 +353,8 @@ mkPersist tsn_codegen_config [groundhog| - name: db_status dbName: status -# Many of the JFileGameOddsInfo fields are redundant and have -# been left out. + # Many of the JFileGameOddsInfo fields are redundant and have + # been left out. - embedded: JFileGameOddsInfo fields: - name: db_list_date diff --git a/src/TSN/XML/Odds.hs b/src/TSN/XML/Odds.hs index 1401c81..5174ddb 100644 --- a/src/TSN/XML/Odds.hs +++ b/src/TSN/XML/Odds.hs @@ -23,6 +23,7 @@ module TSN.XML.Odds ( where -- System imports. +import Control.Applicative ( (<$>) ) import Control.Monad ( forM_, join ) import Data.Time ( UTCTime(..) ) import Data.Tuple.Curry ( uncurryN ) @@ -308,16 +309,16 @@ instance FromXmlFkTeams OddsGameXml where (xml_team_rotation_number xml_home_team), db_away_team_starter_id = - (fmap fst $ xml_team_starter xml_away_team), + (fst <$> xml_team_starter xml_away_team), db_away_team_starter_name = - (fmap snd $ xml_team_starter xml_away_team), + (snd <$> xml_team_starter xml_away_team), db_home_team_starter_id = - (fmap fst $ xml_team_starter xml_home_team), + (fst <$> xml_team_starter xml_home_team), db_home_team_starter_name = - (fmap snd $ xml_team_starter xml_home_team) } + (snd <$> xml_team_starter xml_home_team) } -- | This lets us insert the XML representation 'OddsGameXml' directly. diff --git a/src/TSN/XML/ScheduleChanges.hs b/src/TSN/XML/ScheduleChanges.hs index c447f35..151b615 100644 --- a/src/TSN/XML/ScheduleChanges.hs +++ b/src/TSN/XML/ScheduleChanges.hs @@ -303,7 +303,7 @@ mkPersist tsn_codegen_config [groundhog| # Prevent multiple imports of the same message. fields: [db_xml_file_id] -# Note: we drop the "sc" prefix from the db_sc_sport field. + # Note: we drop the "sc" prefix from the db_sc_sport field. - entity: ScheduleChangesListing dbName: schedule_changes_listings constructors: diff --git a/src/TSN/XML/Scores.hs b/src/TSN/XML/Scores.hs index 8e9f65f..adbd5cd 100644 --- a/src/TSN/XML/Scores.hs +++ b/src/TSN/XML/Scores.hs @@ -219,8 +219,8 @@ instance FromXmlFkTeams ScoreGameXml where db_home_team_id = fk_home, db_away_team_score = xml_away_team_score, db_home_team_score = xml_home_team_score, - db_away_team_pitcher = (xml_vpitcher $ xml_vteam), - db_home_team_pitcher = (xml_hpitcher $ xml_hteam), + db_away_team_pitcher = xml_vpitcher xml_vteam, + db_home_team_pitcher = xml_hpitcher xml_hteam, db_time_r = xml_time_r, db_status = xml_status, db_notes = xml_notes } diff --git a/src/TSN/XML/SportInfo.hs b/src/TSN/XML/SportInfo.hs index 0ceba41..a9e1f1a 100644 --- a/src/TSN/XML/SportInfo.hs +++ b/src/TSN/XML/SportInfo.hs @@ -318,7 +318,7 @@ test_dbimport_succeeds = testCase "dbimport succeeds" $ do xmltrees <- mapM unsafe_read_document sport_info_test_files let msgs = rights $ map (parse_xml "dummy") xmltrees actual <- withSqliteConn ":memory:" $ runDbConn $ do - runMigration silentMigrationLogger $ do + runMigration silentMigrationLogger $ migrate (undefined :: SportInfo) mapM_ dbimport msgs countAll (undefined :: SportInfo) diff --git a/src/TSN/XML/Weather.hs b/src/TSN/XML/Weather.hs index 26935cf..47e931f 100644 --- a/src/TSN/XML/Weather.hs +++ b/src/TSN/XML/Weather.hs @@ -384,7 +384,8 @@ mkPersist tsn_codegen_config [groundhog| reference: onDelete: cascade -# We rename the two fields that needed a "dtl" prefix to avoid a name clash. + # We rename the two fields that needed a "dtl" prefix to avoid a name + # clash. - entity: WeatherDetailedWeatherListingItem dbName: weather_detailed_items constructors: @@ -714,7 +715,7 @@ unsafe_get_xmltree path = -- test_types_detected_correctly :: TestTree test_types_detected_correctly = - testGroup "weatherxml types detected correctly" $ + testGroup "weatherxml types detected correctly" [ check "test/xml/weatherxml.xml" "first type detected correctly" True,