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/SetEnv.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 'apps/SetEnv.hs')
-rw-r--r-- | apps/SetEnv.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/SetEnv.hs b/apps/SetEnv.hs index 2f3b8f7..0c8df32 100644 --- a/apps/SetEnv.hs +++ b/apps/SetEnv.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 @@ -51,9 +51,7 @@ main = execParser parser >>= setEnv fullDesc <> progDesc "Set environment variables" setEnv :: Options -> IO () -setEnv options = do - ret <- runExceptT $ lift $ void $ promptAnd $ runExceptT engrave - either ioError return ret +setEnv options = runExceptT doSetEnv >>= either ioError return where varName = optName options varValue = optValue options @@ -69,3 +67,5 @@ setEnv options = do | otherwise = withPrompt $ engraveMessage profile varName "" varValue engrave = Env.engrave profile varName varValue + + doSetEnv = void $ promptAnd engrave |