on master help sign in
command: Make bracket usage a bit more idiomatic
commit911356f1e05cfb7c0e045c217e7784fe16067097 authorElliot Cameron <eacameron@gmail.com> dateTue 10 Mar 2020, 14:26 (7 years ago) parentc121cb7
1 file changed+9−4
lib/command/src/Obelisk/Command/Deploy.hs+9−4
lib/command/src/Obelisk/Command/Deploy.hs+9−4
@@ -8,7 +8,7 @@ module Obelisk.Command.Deploy where
88
99import Control.Lens
1010import Control.Monad
11−import Control.Monad.Catch (Exception (displayException), MonadThrow, throwM, try, bracket_)
11+import Control.Monad.Catch (Exception (displayException), MonadThrow, bracket, throwM, try)
1212import Control.Monad.IO.Class (liftIO)
1313import Data.Aeson (FromJSON, ToJSON, encode, eitherDecode)
1414import Data.Bits
@@ -244,9 +244,14 @@ deployMobile platform mobileArgs = withProjectRoot "." $ \root -> do
244244 putLog Notice $ T.pack $ unwords ["Your recently built", mobileArtifact, "can be found at the following path:", show result]
245245 callProcessAndLogOutput (Notice, Error) $ proc (result </> "bin" </> "deploy") (mobileArgs ++ extraArgs)
246246 where
247− withEcho showEcho f = do
248− prevEcho <- hGetEcho stdin
249− bracket_ (hSetEcho stdin showEcho) (hSetEcho stdin prevEcho) f
247+ withEcho showEcho f = bracket
248+ (do
249+ prevEcho <- hGetEcho stdin
250+ hSetEcho stdin showEcho
251+ pure prevEcho
252+ )
253+ (hSetEcho stdin)
254+ (const f)
250255
251256data KeytoolConfig = KeytoolConfig
252257 { _keytoolConfig_keystore :: FilePath