]> gitweb.michael.orlitzky.com - dead/harbl.git/commitdiff
Fix hlint suggestions.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 18 Jul 2015 14:06:14 +0000 (10:06 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 18 Jul 2015 14:06:14 +0000 (10:06 -0400)
harbl-cli/src/Main.hs
harbl-cli/src/OptionalConfiguration.hs
harbl.cabal
makefile

index 7b28af57cacfd59327cf7ab7471f32a8eb5a3bc3..9e6e0579c473bbef1afec1e8c391aeeeb0e6d42e 100644 (file)
@@ -8,7 +8,7 @@ import Data.Monoid ( (<>) )
 import Text.Parsec ( ParseError, parse )
 import System.Console.CmdArgs ( def )
 import System.Exit ( exitSuccess, exitWith, ExitCode (ExitFailure) )
-import System.IO ( hPutStrLn, stderr )
+import System.IO ( hPrint, stderr )
 
 import CommandLine ( get_args )
 import Configuration ( Configuration(..), merge_optional )
@@ -73,12 +73,12 @@ main = do
 
   case (parse_lists $ lists cfg) of
     Left e -> do
-      hPutStrLn stderr (show e)
+      hPrint stderr e
       exitWith (ExitFailure exit_unparseable_list)
-    Right ls -> do
+    Right ls ->
       case (parse_hosts $ hosts cfg) of
         Left e -> do
-          hPutStrLn stderr (show e)
+          hPrint stderr e
           exitWith (ExitFailure exit_unparseable_host)
         Right hs -> do
           listings <- concatMapM (lookup_rbl ls) hs
index 37d05a9431af2bb44e8f862691e936b1f627e8d5..66e47858b227b8cb6112a026c973d90a1d01d8eb 100644 (file)
@@ -1,7 +1,5 @@
 {-# LANGUAGE DeriveDataTypeable #-}
 {-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE StandaloneDeriving #-}
 
 -- | An OptionalConfiguration is just like a 'Configuration', except
 --   all of its fields are optional. The user can set options in two
@@ -24,13 +22,14 @@ import qualified Data.Configurator as DC (
 import Data.Data ( Data )
 import Data.Maybe ( fromMaybe )
 import Data.Monoid ( Monoid(..) )
+import Data.Text ( pack )
 import Data.Typeable ( Typeable )
 import Paths_harbl ( getSysconfDir )
 import System.Console.CmdArgs.Default ( Default(..) )
 import System.Directory ( getHomeDirectory )
 import System.FilePath ( (</>) )
 import System.IO.Error ( catchIOError )
-import System.IO ( hPutStrLn, stderr )
+import System.IO ( hPrint, stderr )
 
 -- Harbl library imports.
 import Network.DNS.RBL.Weight ( Weight )
@@ -162,18 +161,18 @@ instance Monoid OptionalConfiguration where
 from_rc :: IO OptionalConfiguration
 from_rc = do
   etc  <- catchIOError getSysconfDir (\e -> do
-                                        hPutStrLn stderr (show e)
+                                        hPrint stderr e
                                         return "/etc")
   home <- catchIOError getHomeDirectory (\e -> do
-                                           hPutStrLn stderr (show e)
+                                           hPrint stderr e
                                            return "$(HOME)")
   let global_config_path = etc </> "harblrc"
   let user_config_path = home </> ".harblrc"
   cfg <- DC.load [ DC.Optional global_config_path,
                    DC.Optional user_config_path ]
-  cfg_lists <- DC.lookup cfg "lists"
-  cfg_hosts <- DC.lookup cfg "hosts"
-  cfg_threshold <- DC.lookup cfg "threshold"
+  cfg_lists <- DC.lookup cfg (pack "lists")
+  cfg_hosts <- DC.lookup cfg (pack "hosts")
+  cfg_threshold <- DC.lookup cfg (pack "threshold")
   return $ OptionalConfiguration
              (fromMaybe def cfg_hosts)
              (fromMaybe def cfg_lists)
index 24a67c253f9c31e9936d2078323310fbd1c29dce..c8cb1e5283f18ff0041c9df4e89e0aa551250d94 100644 (file)
@@ -76,7 +76,8 @@ executable harbl
     directory,
     filepath,
     harbl,
-    parsec                      >= 3
+    parsec                      >= 3,
+    text
 
   main-is: Main.hs
 
index 23882488be0548abb144ec193e2e189032c3c31d..6792f483e568e0a4ecf82af42c9b5b0e565e35ee 100644 (file)
--- a/makefile
+++ b/makefile
@@ -55,4 +55,4 @@ hlint:
        hlint --ignore="Use camelCase"     \
              --ignore="Redundant bracket" \
              --color                      \
-             src
+             $(SRCS)