summaryrefslogtreecommitdiff
path: root/src/Advent.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Advent.hs')
-rw-r--r--src/Advent.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Advent.hs b/src/Advent.hs
index 6d8f7bc..9874382 100644
--- a/src/Advent.hs
+++ b/src/Advent.hs
@@ -52,6 +52,7 @@ module Advent (
, AoCOpts(..)
, SubmitRes(..), showSubmitRes
, runAoC
+ , runAoC_
, defaultAoCOpts
, AoCError(..)
-- ** Calendar
@@ -357,6 +358,13 @@ runAoC AoCOpts{..} a = do
mcr <- maybe (throwError AoCThrottleError) pure mtr
either (throwError . AoCClientError) pure mcr
+-- | A version of 'runAoC' that throws an IO exception (of type 'AoCError')
+-- upon failure, instead of an 'Either'.
+--
+-- @since 0.2.5.0
+runAoC_ :: AoCOpts -> AoC a -> IO a
+runAoC_ o = either throwIO pure <=< runAoC o
+
aocClientEnv :: String -> IO ClientEnv
aocClientEnv s = do
t <- getCurrentTime