Skip to content

Commit 114b0fa

Browse files
committed
Use safe exceptions everywhere
1 parent 68166dc commit 114b0fa

13 files changed

Lines changed: 47 additions & 37 deletions

File tree

webapi-client-reflex-dom/src/WebApi/Client/Reflex.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{-# LANGUAGE PolyKinds #-}
1010
module WebApi.Client.Reflex where
1111

12-
import Control.Exception
12+
import Control.Exception.Safe
1313
import Control.Monad
1414
import Data.Bifunctor
1515
import Data.ByteString (ByteString)

webapi-client-reflex-dom/webapi-client-reflex-dom.cabal

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-- further documentation, see http://haskell.org/cabal/users-guide/
33

44
name: webapi-client-reflex-dom
5-
version: 0.2.0.0
5+
version: 0.3.0.0
66
synopsis: Type safe XHR client for webapi using reflex-dom
77
-- description:
88
homepage: https://github.com/byteally/webapi
@@ -20,7 +20,7 @@ library
2020
exposed-modules: WebApi.Client.Reflex
2121
-- other-modules:
2222
build-depends: base >= 4.9 && < 5
23-
, webapi-contract == 0.5.*
23+
, webapi-contract == 0.6.*
2424
, reflex >= 0.6.4 && < 0.10
2525
, reflex-dom-core >= 0.7 && < 0.9
2626
, ghcjs-dom
@@ -31,6 +31,8 @@ library
3131
, case-insensitive >= 1.2
3232
, http-types >= 0.8
3333
, http-media >= 0.7 && < 0.9
34+
, safe-exceptions >= 0.1.7 && < 0.2
35+
3436
hs-source-dirs: src
3537
default-language: Haskell2010
3638
ghc-options: -Wall -Werror -O2

webapi-contract/src/WebApi/Contract.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ module WebApi.Contract
8383
, OpId (..)
8484
) where
8585

86-
import Control.Exception (SomeException, Exception)
86+
import Control.Exception.Safe (SomeException, Exception)
8787
import Data.Aeson (Value)
8888
import Data.Proxy
8989
import Data.Text (Text)

webapi-contract/webapi-contract.cabal

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cabal-version: 2.4
33
-- documentation, see http://haskell.org/cabal/users-guide/
44

55
name: webapi-contract
6-
version: 0.5
6+
version: 0.6
77
synopsis: Contracts for webapi library
88
description: Contracts for webapi library
99
homepage: http://byteally.github.io/webapi/
@@ -37,6 +37,8 @@ common lib-common
3737
, unordered-containers >= 0.2.4 && < 0.3
3838
, choice >= 0.2.2
3939
, uuid-types == 1.0.*
40+
, safe-exceptions >= 0.1.7 && < 0.2
41+
4042

4143
ghc-options: -Wall
4244
default-language: Haskell2010

webapi-reflex-dom/src/WebApi/Reflex/Dom/Router.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ import qualified Data.ByteString.Char8 as Char8
7676
import Data.Typeable
7777
import Data.Maybe
7878
import GHC.Stack
79-
import Control.Exception (SomeException (..), Exception(..))
79+
import Control.Exception.Safe (SomeException (..), Exception(..))
8080

8181
-- Compact Start
8282
import GHC.Records

webapi-reflex-dom/webapi-reflex-dom.cabal

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.4
22
name: webapi-reflex-dom
3-
version: 0.2.0.0
3+
version: 0.3.0.0
44

55
-- A short (one-line) description of the package.
66
-- synopsis:
@@ -44,6 +44,8 @@ library
4444
, mtl
4545
, ref-tf
4646
, exception-transformers
47+
, safe-exceptions >= 0.1.7 && < 0.2
48+
4749
hs-source-dirs: src
4850
default-language: Haskell2010
4951

webapi/ChangeLog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.6
4+
* Use `Control.Exception.Safe` everywhere instead of `Control.Exception` from `base`.
5+
* Lift `client` to work over `MonadUnliftIO m` instead of `IO`.
6+
* Added support for GHC 9.6
7+
8+
## 0.5
9+
* Added support for GHC 9.2
10+
311
## 0.3
412
* WebApiImplementation typeclass is renamed to WebApiServer
513
* Swapped the order of FromParam and ToParam class parameters.

webapi/src/WebApi/Client.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module WebApi.Client
5858
, HC.tlsManagerSettings
5959
) where
6060

61-
import Control.Exception
61+
import Control.Exception.Safe
6262
import Control.Monad ( (>=>) )
6363
import qualified Control.Monad.Catch as C
6464
import Data.Bifunctor
@@ -75,7 +75,6 @@ import qualified Data.Text as T
7575
import Data.Text.Encoding (decodeUtf8)
7676
import qualified Data.Text.Encoding as T
7777
import Data.Time.Clock ( getCurrentTime, addUTCTime, nominalDay )
78-
import Data.Typeable (Typeable)
7978
import Data.Word
8079
import GHC.Exts
8180
import qualified Network.HTTP.Client as HC

webapi/src/WebApi/Internal.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
module WebApi.Internal where
2222

2323
import Data.Text.Encoding (encodeUtf8Builder)
24-
import Control.Exception
25-
import Control.Monad.Catch (MonadCatch)
24+
import Control.Exception.Safe
2625
import Control.Monad.IO.Class (MonadIO)
2726
import Control.Monad.Trans.Resource (runResourceT,
2827
withInternalState)
@@ -36,7 +35,6 @@ import Data.Monoid ((<>))
3635
import Data.Maybe (fromMaybe)
3736
import Data.Proxy
3837
import qualified Data.Text as T (pack)
39-
import Data.Typeable (Typeable)
4038
import Network.HTTP.Media (MediaType, mapAcceptMedia,
4139
matchAccept, matchContent
4240
, mapAccept)

webapi/src/WebApi/Mock.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ module WebApi.Mock
2222
, mockClient
2323
) where
2424

25-
import Control.Exception
26-
import Data.Typeable (Typeable)
25+
import Control.Exception.Safe
2726
import GHC.Generics (Generic)
2827
import Network.HTTP.Types (Status, ok200)
2928
import qualified Network.Wai as Wai

0 commit comments

Comments
 (0)