aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apps/SetEnv.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/SetEnv.hs
parentfix export lists (diff)
downloadwindows-env-f1a4c2b98f1707c09e17ddd07cb25d6e1cfe4022.tar.gz
windows-env-f1a4c2b98f1707c09e17ddd07cb25d6e1cfe4022.zip
use monad transformers
Diffstat (limited to '')
-rw-r--r--apps/SetEnv.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/SetEnv.hs b/apps/SetEnv.hs
index 96ef7b1..2f3b8f7 100644
--- a/apps/SetEnv.hs
+++ b/apps/SetEnv.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
@@ -48,7 +51,9 @@ main = execParser parser >>= setEnv
fullDesc <> progDesc "Set environment variables"
setEnv :: Options -> IO ()
-setEnv options = void $ promptAnd engrave
+setEnv options = do
+ ret <- runExceptT $ lift $ void $ promptAnd $ runExceptT engrave
+ either ioError return ret
where
varName = optName options
varValue = optValue options