From: Michael Orlitzky Date: Mon, 13 Jan 2014 04:01:55 +0000 (-0500) Subject: Remove unused XmlPickler instances (this might need to be revisited if regular-xmlpic... X-Git-Tag: 0.0.1~85 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=ef96e8bf0cadf5d602022f8c91914d3cabeb35a0;p=dead%2Fhtsn-import.git Remove unused XmlPickler instances (this might need to be revisited if regular-xmlpickler sees a new release). --- diff --git a/src/Main.hs b/src/Main.hs index 8d4999a..6c8223d 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -3,6 +3,7 @@ module Main where +-- System imports. import Control.Arrow ( (&&&), (>>^), arr, returnA ) import Control.Concurrent ( threadDelay ) import Control.Exception ( SomeException, catch ) @@ -29,9 +30,9 @@ import Text.XML.HXT.Core ( hasName, readDocument, runX, - unpickleDoc, - xpickle) + unpickleDoc ) +-- Local imports. import Backend ( Backend(..) ) import CommandLine ( get_args ) import Configuration ( Configuration(..), merge_optional ) @@ -45,10 +46,10 @@ import Network.Services.TSN.Report ( report_error ) import TSN.DbImport ( DbImport(..), ImportResult(..) ) import qualified TSN.XML.Heartbeat as Heartbeat ( verify ) -import qualified TSN.XML.Injuries as Injuries ( Message ) -import qualified TSN.XML.InjuriesDetail as InjuriesDetail ( Message ) -import qualified TSN.XML.News as News ( Message ) -import qualified TSN.XML.Odds as Odds ( Message ) +import qualified TSN.XML.Injuries as Injuries ( pickle_message ) +import qualified TSN.XML.InjuriesDetail as InjuriesDetail ( pickle_message ) +import qualified TSN.XML.News as News ( pickle_message ) +import qualified TSN.XML.Odds as Odds ( pickle_message ) import Xml ( DtdName(..), parse_opts ) @@ -150,23 +151,23 @@ import_file cfg path = do importer | dtd == "injuriesxml.dtd" = do - let m = unpickleDoc xpickle xml :: Maybe Injuries.Message + let m = unpickleDoc Injuries.pickle_message xml let errmsg = "Could not unpickle injuriesxml." maybe (return $ ImportFailed errmsg) migrate_and_import m | dtd == "Injuries_Detail_XML.dtd" = do - let m = unpickleDoc xpickle xml :: Maybe InjuriesDetail.Message + let m = unpickleDoc InjuriesDetail.pickle_message xml let errmsg = "Could not unpickle Injuries_Detail_XML." maybe (return $ ImportFailed errmsg) migrate_and_import m | dtd == "newsxml.dtd" = do - let m = unpickleDoc xpickle xml :: Maybe News.Message + let m = unpickleDoc News.pickle_message xml let errmsg = "Could not unpickle newsxml." maybe (return $ ImportFailed errmsg) migrate_and_import m | dtd == "Odds_XML.dtd" = do - let m = unpickleDoc xpickle xml :: Maybe Odds.Message + let m = unpickleDoc Odds.pickle_message xml let errmsg = "Could not unpickle Odds_XML." maybe (return $ ImportFailed errmsg) migrate_and_import m diff --git a/src/TSN/XML/Heartbeat.hs b/src/TSN/XML/Heartbeat.hs index 588c75c..7c62445 100644 --- a/src/TSN/XML/Heartbeat.hs +++ b/src/TSN/XML/Heartbeat.hs @@ -14,7 +14,6 @@ import Test.Tasty.HUnit ( (@?=), testCase ) import Text.XML.HXT.Core ( PU, unpickleDoc, - XmlPickler(..), XmlTree, xpTriple, xpElem, diff --git a/src/TSN/XML/Injuries.hs b/src/TSN/XML/Injuries.hs index 7ffca26..a93d788 100644 --- a/src/TSN/XML/Injuries.hs +++ b/src/TSN/XML/Injuries.hs @@ -14,8 +14,8 @@ -- automatically. The root message is not retained. -- module TSN.XML.Injuries ( - Message, - injuries_tests ) + injuries_tests, + pickle_message ) where import Data.Data ( Data ) @@ -31,7 +31,6 @@ import Test.Tasty ( TestTree, testGroup ) import Test.Tasty.HUnit ( (@?=), testCase ) import Text.XML.HXT.Core ( PU, - XmlPickler(..), xp4Tuple, xp6Tuple, xpAttr, @@ -110,8 +109,6 @@ pickle_injuries_team = from_tuple = uncurryN InjuriesTeam to_tuple m = (team_name m, team_league m) -instance XmlPickler InjuriesTeam where - xpickle = pickle_injuries_team pickle_listing :: PU Listing pickle_listing = @@ -125,9 +122,6 @@ pickle_listing = from_tuple = uncurryN Listing to_tuple l = (team l, teamno l, injuries l, updated l) -instance XmlPickler Listing where - xpickle = pickle_listing - pickle_message :: PU Message pickle_message = @@ -148,9 +142,6 @@ pickle_message = listings m, time_stamp m) -instance XmlPickler Message where - xpickle = pickle_message - -- * Tasty Tests diff --git a/src/TSN/XML/InjuriesDetail.hs b/src/TSN/XML/InjuriesDetail.hs index 431eec1..856e800 100644 --- a/src/TSN/XML/InjuriesDetail.hs +++ b/src/TSN/XML/InjuriesDetail.hs @@ -17,8 +17,8 @@ -- are not retained. -- module TSN.XML.InjuriesDetail ( - Message, - injuries_detail_tests ) + injuries_detail_tests, + pickle_message ) where import Data.Time ( UTCTime ) @@ -33,7 +33,6 @@ import Test.Tasty ( TestTree, testGroup ) import Test.Tasty.HUnit ( (@?=), testCase ) import Text.XML.HXT.Core ( PU, - XmlPickler(..), xpTriple, xp6Tuple, xp10Tuple, @@ -130,8 +129,6 @@ pickle_player_listing = injured pl, injury_type pl) -instance XmlPickler PlayerListing where - xpickle = pickle_player_listing pickle_listing :: PU Listing pickle_listing = @@ -144,9 +141,6 @@ pickle_listing = from_tuple = uncurryN Listing to_tuple l = (listing_team_id l, full_name l, player_listings l) -instance XmlPickler Listing where - xpickle = pickle_listing - pickle_message :: PU Message pickle_message = @@ -167,9 +161,6 @@ pickle_message = listings m, time_stamp m) -instance XmlPickler Message where - xpickle = pickle_message - -- * Tasty Tests injuries_detail_tests :: TestTree diff --git a/src/TSN/XML/News.hs b/src/TSN/XML/News.hs index 67611e5..a2421e9 100644 --- a/src/TSN/XML/News.hs +++ b/src/TSN/XML/News.hs @@ -11,8 +11,8 @@ -- root element \ that contains an entire news item. -- module TSN.XML.News ( - Message, - news_tests ) + news_tests, + pickle_message ) where import Data.Data ( Data, constrFields, dataTypeConstrs, dataTypeOf ) @@ -31,7 +31,6 @@ import Test.Tasty ( TestTree, testGroup ) import Test.Tasty.HUnit ( (@?=), testCase ) import Text.XML.HXT.Core ( PU, - XmlPickler(..), xp13Tuple, xpAttr, xpElem, @@ -237,8 +236,6 @@ pickle_news_team = from_string :: String -> NewsTeam from_string = NewsTeam -instance XmlPickler NewsTeam where - xpickle = pickle_news_team pickle_msg_id :: PU MsgId pickle_msg_id = @@ -249,8 +246,6 @@ pickle_msg_id = from_tuple = uncurryN MsgId to_tuple m = (db_msg_id m, db_event_id m) -instance XmlPickler MsgId where - xpickle = pickle_msg_id pickle_location :: PU NewsLocation pickle_location = @@ -264,8 +259,6 @@ pickle_location = uncurryN NewsLocation to_tuple l = (city l, state l, country l) -instance XmlPickler NewsLocation where - xpickle = pickle_location pickle_message :: PU Message @@ -314,9 +307,6 @@ pickle_message = to_string :: [String] -> String to_string = join "\n" -instance XmlPickler Message where - xpickle = pickle_message - -- * Tasty Tests diff --git a/src/TSN/XML/Odds.hs b/src/TSN/XML/Odds.hs index 3a508ee..c5b5c01 100644 --- a/src/TSN/XML/Odds.hs +++ b/src/TSN/XML/Odds.hs @@ -12,9 +12,8 @@ -- unorganized crap. -- module TSN.XML.Odds ( - Odds, - Message, - odds_tests ) + odds_tests, + pickle_message ) where import Control.Monad ( forM_ ) @@ -404,9 +403,6 @@ pickle_casino = xml_casino_name, xml_casino_line) -instance XmlPickler OddsGameCasinoXml where - xpickle = pickle_casino - pickle_home_team :: PU OddsGameHomeTeamXml pickle_home_team = @@ -427,8 +423,6 @@ pickle_home_team = xml_home_team_name, xml_home_casinos) -instance XmlPickler OddsGameHomeTeamXml where - xpickle = pickle_home_team pickle_away_team :: PU OddsGameAwayTeamXml @@ -451,9 +445,6 @@ pickle_away_team = xml_away_casinos) -instance XmlPickler OddsGameAwayTeamXml where - xpickle = pickle_away_team - pickle_over_under :: PU OddsGameOverUnderXml pickle_over_under = @@ -464,8 +455,6 @@ pickle_over_under = from_newtype (OddsGameOverUnderXml cs) = cs to_newtype = OddsGameOverUnderXml -instance XmlPickler OddsGameOverUnderXml where - xpickle = pickle_over_under pickle_game :: PU OddsGameXml @@ -489,9 +478,6 @@ pickle_game = xml_game_home_team, xml_game_over_under) -instance XmlPickler OddsGameXml where - xpickle = pickle_game - pickle_message :: PU Message pickle_message = @@ -517,11 +503,6 @@ pickle_message = xml_time_stamp m) -instance XmlPickler Message where - xpickle = pickle_message - - - -- * Tasty Tests odds_tests :: TestTree