diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-12-13 01:47:35 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-12-13 01:47:35 +0300 |
commit | d7d33810d562a80e0954bafe045ae2275109999a (patch) | |
tree | b07e041a8d6c840df460b5a6dd3e4fa1d56b29a8 /apps/UnsetEnv.hs | |
parent | use monad transformers (diff) | |
download | windows-env-d7d33810d562a80e0954bafe045ae2275109999a.tar.gz windows-env-d7d33810d562a80e0954bafe045ae2275109999a.zip |
bugfix (withPrompt no longer swallows IOError)
Diffstat (limited to '')
-rw-r--r-- | apps/UnsetEnv.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/UnsetEnv.hs b/apps/UnsetEnv.hs index d56d40c..f0352b4 100644 --- a/apps/UnsetEnv.hs +++ b/apps/UnsetEnv.hs @@ -6,12 +6,12 @@ module Main (main) where -import Control.Monad (void) -import Control.Monad.Trans.Class -import Control.Monad.Trans.Except +import Control.Monad (void) +import Control.Monad.Trans.Except (runExceptT) import System.IO.Error (ioError) -import Options.Applicative +import Options.Applicative + import qualified Windows.Environment as Env import Prompt @@ -46,9 +46,7 @@ main = execParser parser >>= unsetEnv fullDesc <> progDesc "Unset environment variables" unsetEnv :: Options -> IO () -unsetEnv options = do - ret <- runExceptT $ lift $ void $ promptAnd $ runExceptT wipe - either ioError return ret +unsetEnv options = runExceptT doUnsetEnv >>= either ioError return where varName = optName options @@ -63,3 +61,5 @@ unsetEnv options = do | otherwise = withPrompt $ wipeMessage profile varName wipe = Env.wipe profile varName + + doUnsetEnv = void $ promptAnd wipe |