]> gitweb.michael.orlitzky.com - dead/htsn-import.git/commitdiff
Fix hlint suggestions.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 2 Jan 2014 17:00:42 +0000 (12:00 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 2 Jan 2014 17:00:42 +0000 (12:00 -0500)
src/Main.hs
src/TSN/XML/News.hs
src/TSN/XML/Odds.hs
src/Xml.hs

index e8c1356b6dd40234046b9f8f44be4188f8f6c4b4..d66f704e8d0cd91ce1676b75380e85146cdbed67 100644 (file)
@@ -211,7 +211,7 @@ main = do
       report_info $ "Removed processed file " ++ path ++ "."
 
     -- | Try to remove @path@ and potentially try again.
-    kill try_again path = do
+    kill try_again path =
       (remove_and_report path) `catchIOError` exception_handler
       where
         -- | A wrapper around threadDelay which takes seconds instead of
@@ -228,7 +228,7 @@ main = do
           report_error (show e)
           report_error $ "Failed to remove imported file " ++ path ++ "."
           if try_again then do
-            report_info "Waiting 5 seconds to attempt removal again..."
+            report_info "Waiting 5 seconds to attempt removal again..."
             thread_sleep 5
             kill False path
           else
index 26ca8c0deb76670e3aeee7ec28ac1567baec2ddd..565c7a52fb038b10e377b651bee1b58c73a49777 100644 (file)
@@ -270,8 +270,8 @@ pickle_message =
               (xpElem "category" xpText)
               (xpElem "sport" xpText)
               (xpElem "url" xpText)
-              (xpList pickle_news_team)
-              (xpList pickle_location)
+              (xpList pickle_news_team)
+              (xpList pickle_location)
               (xpElem "SMS" xpText)
               (xpOption (xpElem "Editor" xpText))
               (xpElem "text" xpText)
@@ -297,7 +297,7 @@ pickle_message =
     pickle_continue =
       xpWrap (to_string, from_string) $
         xpElem "continue" $
-          (xpList $ xpElem "P" xpText)
+          xpList (xpElem "P" xpText)
       where
         from_string :: String -> [String]
         from_string = split "\n"
@@ -339,15 +339,13 @@ news_tests =
   testGroup
     "News tests"
     [ test_news_fields_have_correct_names,
-      test_pickle_of_unpickle_is_identity1,
-      test_pickle_of_unpickle_is_identity2,
-      test_unpickle_succeeds1,
-      test_unpickle_succeeds2 ]
+      test_pickle_of_unpickle_is_identity,
+      test_unpickle_succeeds ]
 
 
 test_news_fields_have_correct_names :: TestTree
 test_news_fields_have_correct_names =
-  testCase "news fields get correct database names" $ do
+  testCase "news fields get correct database names" $
     mapM_ check (zip actual expected)
   where
     -- This is cool, it uses the (derived) Data instance of
@@ -368,34 +366,28 @@ test_news_fields_have_correct_names =
 
 -- | Warning, succeess of this test does not mean that unpickling
 --   succeeded.
-test_pickle_of_unpickle_is_identity1 :: TestTree
-test_pickle_of_unpickle_is_identity1 =
-  testCase "pickle composed with unpickle is the identity" $ do
-    let path = "test/xml/newsxml.xml"
-    (expected :: [MessageXml], actual) <- pickle_unpickle "message" path
-    actual @?= expected
-
--- | Repeat of 'test_pickle_of_unpickle_is_identity1' with a different
---   XML file.
-test_pickle_of_unpickle_is_identity2 :: TestTree
-test_pickle_of_unpickle_is_identity2 =
-  testCase "pickle composed with unpickle is the identity (with Editor)" $ do
-    let path = "test/xml/newsxml-with-editor.xml"
-    (expected :: [MessageXml], actual) <- pickle_unpickle "message" path
-    actual @?= expected
-
-test_unpickle_succeeds1 :: TestTree
-test_unpickle_succeeds1 =
-  testCase "unpickling succeeds" $ do
-  let path = "test/xml/newsxml.xml"
-  actual <- unpickleable path pickle_message
-  let expected = True
-  actual @?= expected
-
-test_unpickle_succeeds2 :: TestTree
-test_unpickle_succeeds2 =
-  testCase "unpickling succeeds (with Editor)" $ do
-  let path = "test/xml/newsxml-with-editor.xml"
-  actual <- unpickleable path pickle_message
-  let expected = True
-  actual @?= expected
+test_pickle_of_unpickle_is_identity :: TestTree
+test_pickle_of_unpickle_is_identity = testGroup "pickle-unpickle tests"
+  [ check "pickle composed with unpickle is the identity"
+          "test/xml/newsxml.xml",
+
+    check "pickle composed with unpickle is the identity (with Editor)"
+          "test/xml/newsxml-with-editor.xml" ]
+  where
+    check desc path = testCase desc $ do
+      (expected :: [MessageXml], actual) <- pickle_unpickle "message" path
+      actual @?= expected
+
+
+test_unpickle_succeeds :: TestTree
+test_unpickle_succeeds = testGroup "unpickle tests"
+  [ check "unpickling succeeds"
+          "test/xml/newsxml.xml",
+
+    check "unpickling succeeds (with Editor)"
+          "test/xml/newsxml-with-editor.xml" ]
+  where
+    check desc path = testCase desc $ do
+      actual <- unpickleable path pickle_message
+      let expected = True
+      actual @?= expected
index 9b35736b14aa7152ed48d314bc3ef5b59ea91844..7143c459a4d9fbba182d9ef877c259d6ace59e45 100644 (file)
@@ -250,9 +250,9 @@ pickle_message =
               (xpElem "Title" xpText)
               (xpElem "Line_Time" xpText)
               pickle_notes
-              (xpList pickle_game)
+              (xpList pickle_game)
               pickle_notes
-              (xpList pickle_game)
+              (xpList pickle_game)
               (xpElem "time_stamp" xpText)
   where
     from_tuple = uncurryN MessageXml
@@ -271,7 +271,7 @@ pickle_message =
     pickle_notes :: PU String
     pickle_notes =
       xpWrap (to_string, from_string) $
-          (xpList $ xpElem "Notes" xpText)
+        xpList (xpElem "Notes" xpText)
       where
         from_string :: String -> [String]
         from_string = split "\n"
index 2f68dd09c661de44048f78fe0a45314fe4d38b98..e98e4b1c5fc8a5c3251fbafa57182bf0f0eb4cc6 100644 (file)
@@ -106,7 +106,7 @@ pickle_unpickle :: XmlPickler a
 pickle_unpickle root_element filepath = do
   -- We need to check only the root message element since
   -- readDocument produces a bunch of other junk.
-    expected <- runX arr_getobj
+    expected <- runX arr_getobj
     actual <- runX $ arr_getobj
                      >>>
                      xpickleVal xpickle