diff options
author | jle <> | 2019-12-02 09:04:00 (GMT) |
---|---|---|
committer | hdiff <hdiff@hdiff.luite.com> | 2019-12-02 09:04:00 (GMT) |
commit | b22461d585181704f2f541baddb80190bd694934 (patch) | |
tree | 81400463acb318bdc6bd6f2be8f765a8279e6771 | |
parent | a86749bc557153bc5601cc6d2a45b5cfe7fd96c2 (diff) |
version 0.2.5.00.2.5.0
-rw-r--r-- | CHANGELOG.md | 10 | ||||
-rw-r--r-- | advent-of-code-api.cabal | 4 | ||||
-rw-r--r-- | src/Advent.hs | 8 |
3 files changed, 20 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b5a2523..37c08ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ Changelog ========= +Version 0.2.5.0 +--------------- + +*December 2, 2019* + +<https://github.com/mstksg/advent-of-code-api/releases/tag/v0.2.5.0> + +* Add `runAoC_`, which is `runAoC` but throwing an IO exception instead of + returning an `Either`. + Version 0.2.4.2 --------------- diff --git a/advent-of-code-api.cabal b/advent-of-code-api.cabal index eb89ba1..94cab43 100644 --- a/advent-of-code-api.cabal +++ b/advent-of-code-api.cabal @@ -4,10 +4,10 @@ cabal-version: 1.12 -- -- see: https://github.com/sol/hpack -- --- hash: 00822f3b5bf4103c7c82e15d4dcec35343d1e6a293478fcfdb339c4a7c2ffba1 +-- hash: 47b5a0fa5ec3911f9afa108c1f723d2716f225a23091507886305ff551fdca08 name: advent-of-code-api -version: 0.2.4.2 +version: 0.2.5.0 synopsis: Advent of Code REST API bindings and servant API description: Haskell bindings for Advent of Code REST API and a servant API. Please use responsibly! See README.md or "Advent" module for an introduction and 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 |