Skip to content

Commit

Permalink
small simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
Ptival committed Aug 8, 2023
1 parent 2327713 commit d80b16f
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 d80b16f

Please sign in to comment.