aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apps/UnsetEnv.hs
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-12-12 20:43:42 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-12-12 20:43:42 +0300
commitf1a4c2b98f1707c09e17ddd07cb25d6e1cfe4022 (patch)
tree55877ee2e87e89b552b194966292f6f46eb0982f /apps/UnsetEnv.hs
parentfix export lists (diff)
downloadwindows-env-f1a4c2b98f1707c09e17ddd07cb25d6e1cfe4022.tar.gz
windows-env-f1a4c2b98f1707c09e17ddd07cb25d6e1cfe4022.zip
use monad transformers
Diffstat (limited to '')
-rw-r--r--apps/UnsetEnv.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/UnsetEnv.hs b/apps/UnsetEnv.hs
index 2ca0997..d56d40c 100644
--- a/apps/UnsetEnv.hs
+++ b/apps/UnsetEnv.hs
@@ -7,6 +7,9 @@
module Main (main) where
import Control.Monad (void)
+import Control.Monad.Trans.Class
+import Control.Monad.Trans.Except
+import System.IO.Error (ioError)
import Options.Applicative
import qualified Windows.Environment as Env
@@ -43,7 +46,9 @@ main = execParser parser >>= unsetEnv
fullDesc <> progDesc "Unset environment variables"
unsetEnv :: Options -> IO ()
-unsetEnv options = void $ promptAnd wipe
+unsetEnv options = do
+ ret <- runExceptT $ lift $ void $ promptAnd $ runExceptT wipe
+ either ioError return ret
where
varName = optName options