aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apps
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-08-20 15:54:43 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-08-20 15:54:43 +0300
commit87ae152b71317b99bcbeeab80145ae1f3cf22d83 (patch)
tree0ba746abfb44730f07cf7681f90e6340cfaa0a9b /apps
parentlist_path: no weird symbols in output (diff)
downloadwindows-env-87ae152b71317b99bcbeeab80145ae1f3cf22d83.tar.gz
windows-env-87ae152b71317b99bcbeeab80145ae1f3cf22d83.zip
fix HLint warnings
Diffstat (limited to 'apps')
-rw-r--r--apps/AddPath.hs2
-rw-r--r--apps/ListPath.hs6
-rw-r--r--apps/Prompt.hs4
-rw-r--r--apps/RemovePath.hs2
4 files changed, 7 insertions, 7 deletions
diff --git a/apps/AddPath.hs b/apps/AddPath.hs
index 1f80f70..1b27b84 100644
--- a/apps/AddPath.hs
+++ b/apps/AddPath.hs
@@ -53,7 +53,7 @@ addPath :: Options -> IO ()
addPath options = do
oldValue <- Env.query profile varName
let oldPaths = Env.pathSplit $ fromMaybe "" oldValue
- let newPaths = union oldPaths pathsToAdd
+ let newPaths = oldPaths `union` pathsToAdd
when (length oldPaths /= length newPaths) $ do
let newValue = Env.pathJoin newPaths
let promptAnd = if skipPrompt
diff --git a/apps/ListPath.hs b/apps/ListPath.hs
index bed1978..b9cc121 100644
--- a/apps/ListPath.hs
+++ b/apps/ListPath.hs
@@ -6,7 +6,7 @@
module Main (main) where
-import Control.Monad (filterM, liftM)
+import Control.Monad (filterM)
import Data.Maybe (fromMaybe)
import System.Directory (doesDirectoryExist)
import System.Environment (lookupEnv)
@@ -20,7 +20,7 @@ data WhichPaths = All | ExistingOnly | MissingOnly
shouldListPath :: WhichPaths -> Env.VarValue -> IO Bool
shouldListPath All = return . const True
shouldListPath ExistingOnly = doesDirectoryExist
-shouldListPath MissingOnly = liftM not . doesDirectoryExist
+shouldListPath MissingOnly = fmap not . doesDirectoryExist
data Options = Options
{ optName :: Env.VarName
@@ -53,7 +53,7 @@ listPath options = do
varName = optName options
whichPaths = optWhichPaths options
- query = liftM (fromMaybe "") $ lookupEnv varName
+ query = fromMaybe "" <$> lookupEnv varName
printPaths paths =
filterM (shouldListPath whichPaths) paths >>= mapM_ putStrLn
diff --git a/apps/Prompt.hs b/apps/Prompt.hs
index 07c2299..0beecc2 100644
--- a/apps/Prompt.hs
+++ b/apps/Prompt.hs
@@ -9,7 +9,7 @@ module Prompt
, withoutPrompt
) where
-import Control.Monad (liftM, void, when)
+import Control.Monad (void, when)
import Data.Char (toLower)
import System.IO (hFlush, stdout)
@@ -21,7 +21,7 @@ prompt msg = do
promptYesNo :: String -> IO Bool
promptYesNo msg = do
- response <- liftM (map toLower) $ prompt msg
+ response <- map toLower <$> prompt msg
if response `elem` yeses
then return True
else if response `elem` noes
diff --git a/apps/RemovePath.hs b/apps/RemovePath.hs
index 4c4f289..8d9692b 100644
--- a/apps/RemovePath.hs
+++ b/apps/RemovePath.hs
@@ -52,7 +52,7 @@ main = execParser parser >>= removePath
removePath :: Options -> IO ()
removePath options = do
removePathFrom Env.CurrentUser
- when forAllUsers $ do
+ when forAllUsers $
removePathFrom Env.AllUsers
where
varName = optName options