Skip to content

Commit

Permalink
Merge pull request #271 from GaloisInc/vr/small-simplification
Browse files Browse the repository at this point in the history
small simplification
  • Loading branch information
Ptival authored Aug 8, 2023
2 parents 2327713 + d80b16f commit f3a8f96
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Reopt/Utils/Exit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ where

import Control.Exception (catch)
import Control.Monad.Except (ExceptT, runExceptT)
import Data.Bifunctor (Bifunctor (first))
import Data.ByteString qualified as BS
import Data.Macaw.Utils.IncComp (
IncCompM,
Expand All @@ -22,12 +23,7 @@ import System.IO (hPrint, hPutStrLn, stderr)
import System.IO.Error (ioeGetErrorType, isDoesNotExistError)

handleEitherWithExit :: Show e => Either e a -> IO a
handleEitherWithExit r = do
case r of
Left e -> do
hPrint stderr e
exitFailure
Right b -> pure b
handleEitherWithExit = handleEitherStringWithExit . first show

handleEitherStringWithExit :: Either String a -> IO a
handleEitherStringWithExit r = do
Expand Down

0 comments on commit f3a8f96

Please sign in to comment.