From d7d33810d562a80e0954bafe045ae2275109999a Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 13 Dec 2016 01:47:35 +0300 Subject: bugfix (withPrompt no longer swallows IOError) --- apps/SetEnv.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'apps/SetEnv.hs') 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 -- cgit v1.2.3