packages feed

servant-checked-exceptions 1.0.0.0 → 1.1.0.0

raw patch · 5 files changed

+103/−68 lines, 5 filesdep +servant-client-coredep ~servantdep ~servant-clientdep ~servant-docsPVP ok

version bump matches the API change (PVP)

Dependencies added: servant-client-core

Dependency ranges changed: servant, servant-client, servant-docs, servant-server

API changes (from Hackage documentation)

- Servant.Checked.Exceptions.Internal.Servant.Client: instance Servant.Client.HasClient ((Servant.Checked.Exceptions.Internal.Servant.API.NoThrow Servant.API.Sub.:> api1) Servant.API.Alternative.:<|> (Servant.Checked.Exceptions.Internal.Servant.API.NoThrow Servant.API.Sub.:> api2)) => Servant.Client.HasClient (Servant.Checked.Exceptions.Internal.Servant.API.NoThrow Servant.API.Sub.:> (api1 Servant.API.Alternative.:<|> api2))
- Servant.Checked.Exceptions.Internal.Servant.Client: instance Servant.Client.HasClient ((Servant.Checked.Exceptions.Internal.Servant.API.Throwing es Servant.API.Sub.:> api1) Servant.API.Alternative.:<|> (Servant.Checked.Exceptions.Internal.Servant.API.Throwing es Servant.API.Sub.:> api2)) => Servant.Client.HasClient (Servant.Checked.Exceptions.Internal.Servant.API.Throwing es Servant.API.Sub.:> (api1 Servant.API.Alternative.:<|> api2))
- Servant.Checked.Exceptions.Internal.Servant.Client: instance forall k1 (method :: k1) (status :: GHC.Types.Nat) (ctypes :: [*]) (es :: [*]) a. Servant.Client.HasClient (Servant.API.Verbs.Verb method status ctypes (Servant.Checked.Exceptions.Internal.Envelope.Envelope es a)) => Servant.Client.HasClient (Servant.Checked.Exceptions.Internal.Servant.API.Throwing es Servant.API.Sub.:> Servant.API.Verbs.Verb method status ctypes a)
- Servant.Checked.Exceptions.Internal.Servant.Client: instance forall k1 (method :: k1) (status :: GHC.Types.Nat) (ctypes :: [*]) a. Servant.Client.HasClient (Servant.API.Verbs.Verb method status ctypes (Servant.Checked.Exceptions.Internal.Envelope.Envelope '[] a)) => Servant.Client.HasClient (Servant.Checked.Exceptions.Internal.Servant.API.NoThrow Servant.API.Sub.:> Servant.API.Verbs.Verb method status ctypes a)
- Servant.Checked.Exceptions.Internal.Servant.Client: instance forall k1 e (api :: k1). Servant.Client.HasClient (Servant.Checked.Exceptions.Internal.Servant.API.Throwing '[e] Servant.API.Sub.:> api) => Servant.Client.HasClient (Servant.Checked.Exceptions.Internal.Servant.API.Throws e Servant.API.Sub.:> api)
- Servant.Checked.Exceptions.Internal.Servant.Client: instance forall k1 k (api :: k) (apis :: k1). Servant.Client.HasClient (api Servant.API.Sub.:> (Servant.Checked.Exceptions.Internal.Servant.API.NoThrow Servant.API.Sub.:> apis)) => Servant.Client.HasClient (Servant.Checked.Exceptions.Internal.Servant.API.NoThrow Servant.API.Sub.:> (api Servant.API.Sub.:> apis))
- Servant.Checked.Exceptions.Internal.Servant.Client: instance forall k1 k (es :: [*]) (api :: k) (apis :: k1). Servant.Client.HasClient (Servant.Checked.Exceptions.Internal.Servant.API.ThrowingNonterminal (Servant.Checked.Exceptions.Internal.Servant.API.Throwing es Servant.API.Sub.:> (api Servant.API.Sub.:> apis))) => Servant.Client.HasClient (Servant.Checked.Exceptions.Internal.Servant.API.Throwing es Servant.API.Sub.:> (api Servant.API.Sub.:> apis))
+ Servant.Checked.Exceptions.Internal.Servant.Client: instance (Servant.Client.Core.Internal.RunClient.RunClient m, Servant.Client.Core.Internal.HasClient.HasClient m ((Servant.Checked.Exceptions.Internal.Servant.API.NoThrow Servant.API.Sub.:> api1) Servant.API.Alternative.:<|> (Servant.Checked.Exceptions.Internal.Servant.API.NoThrow Servant.API.Sub.:> api2))) => Servant.Client.Core.Internal.HasClient.HasClient m (Servant.Checked.Exceptions.Internal.Servant.API.NoThrow Servant.API.Sub.:> (api1 Servant.API.Alternative.:<|> api2))
+ Servant.Checked.Exceptions.Internal.Servant.Client: instance (Servant.Client.Core.Internal.RunClient.RunClient m, Servant.Client.Core.Internal.HasClient.HasClient m ((Servant.Checked.Exceptions.Internal.Servant.API.Throwing es Servant.API.Sub.:> api1) Servant.API.Alternative.:<|> (Servant.Checked.Exceptions.Internal.Servant.API.Throwing es Servant.API.Sub.:> api2))) => Servant.Client.Core.Internal.HasClient.HasClient m (Servant.Checked.Exceptions.Internal.Servant.API.Throwing es Servant.API.Sub.:> (api1 Servant.API.Alternative.:<|> api2))
+ Servant.Checked.Exceptions.Internal.Servant.Client: instance forall k1 (m :: * -> *) (method :: k1) (status :: GHC.Types.Nat) (ctypes :: [*]) (es :: [*]) a. Servant.Client.Core.Internal.HasClient.HasClient m (Servant.API.Verbs.Verb method status ctypes (Servant.Checked.Exceptions.Internal.Envelope.Envelope es a)) => Servant.Client.Core.Internal.HasClient.HasClient m (Servant.Checked.Exceptions.Internal.Servant.API.Throwing es Servant.API.Sub.:> Servant.API.Verbs.Verb method status ctypes a)
+ Servant.Checked.Exceptions.Internal.Servant.Client: instance forall k1 (m :: * -> *) (method :: k1) (status :: GHC.Types.Nat) (ctypes :: [*]) a. (Servant.Client.Core.Internal.RunClient.RunClient m, Servant.Client.Core.Internal.HasClient.HasClient m (Servant.API.Verbs.Verb method status ctypes (Servant.Checked.Exceptions.Internal.Envelope.Envelope '[] a))) => Servant.Client.Core.Internal.HasClient.HasClient m (Servant.Checked.Exceptions.Internal.Servant.API.NoThrow Servant.API.Sub.:> Servant.API.Verbs.Verb method status ctypes a)
+ Servant.Checked.Exceptions.Internal.Servant.Client: instance forall k1 (m :: * -> *) e (api :: k1). (Servant.Client.Core.Internal.RunClient.RunClient m, Servant.Client.Core.Internal.HasClient.HasClient m (Servant.Checked.Exceptions.Internal.Servant.API.Throwing '[e] Servant.API.Sub.:> api)) => Servant.Client.Core.Internal.HasClient.HasClient m (Servant.Checked.Exceptions.Internal.Servant.API.Throws e Servant.API.Sub.:> api)
+ Servant.Checked.Exceptions.Internal.Servant.Client: instance forall k1 k (m :: * -> *) (api :: k) (apis :: k1). (Servant.Client.Core.Internal.RunClient.RunClient m, Servant.Client.Core.Internal.HasClient.HasClient m (api Servant.API.Sub.:> (Servant.Checked.Exceptions.Internal.Servant.API.NoThrow Servant.API.Sub.:> apis))) => Servant.Client.Core.Internal.HasClient.HasClient m (Servant.Checked.Exceptions.Internal.Servant.API.NoThrow Servant.API.Sub.:> (api Servant.API.Sub.:> apis))
+ Servant.Checked.Exceptions.Internal.Servant.Client: instance forall k1 k (m :: * -> *) (es :: [*]) (api :: k) (apis :: k1). (Servant.Client.Core.Internal.RunClient.RunClient m, Servant.Client.Core.Internal.HasClient.HasClient m (Servant.Checked.Exceptions.Internal.Servant.API.ThrowingNonterminal (Servant.Checked.Exceptions.Internal.Servant.API.Throwing es Servant.API.Sub.:> (api Servant.API.Sub.:> apis)))) => Servant.Client.Core.Internal.HasClient.HasClient m (Servant.Checked.Exceptions.Internal.Servant.API.Throwing es Servant.API.Sub.:> (api Servant.API.Sub.:> apis))

Files

CHANGELOG.md view
@@ -1,4 +1,8 @@ +## 1.1.0.0++*   Updated the servant dependency to >= 0.12.+ ## 1.0.0.0  *   Add a `ErrStatus` class that can be used to set the HTTP Status Code. Given
servant-checked-exceptions.cabal view
@@ -1,5 +1,5 @@ name:                servant-checked-exceptions-version:             1.0.0.0+version:             1.1.0.0 synopsis:            Checked exceptions for Servant APIs. description:         Please see <https://github.com/cdepillabout/servant-checked-exceptions#readme README.md>. homepage:            https://github.com/cdepillabout/servant-checked-exceptions@@ -41,10 +41,11 @@                      , http-types                      , profunctors                      , tagged-                     , servant >= 0.9 && < 0.12-                     , servant-client >= 0.9 && < 0.12-                     , servant-docs >= 0.9 && < 0.12-                     , servant-server >= 0.9 && < 0.12+                     , servant >= 0.12+                     , servant-client >= 0.12+                     , servant-client-core >= 0.12+                     , servant-docs >= 0.10+                     , servant-server >= 0.12                      , text                      , wai   default-language:    Haskell2010
src/Servant/Checked/Exceptions/Internal/Servant/Client.hs view
@@ -29,7 +29,7 @@ import Data.Proxy (Proxy(Proxy)) import Servant.API (Verb, (:>), (:<|>)) import Servant.Client (HasClient(clientWithRoute, Client))-import Servant.Common.Req (Req)+import Servant.Client.Core  import Servant.Checked.Exceptions.Internal.Envelope (Envelope) import Servant.Checked.Exceptions.Internal.Servant.API@@ -38,102 +38,109 @@ -- TODO: Make sure to also account for when headers are being used.  -- | Change a 'Throws' into 'Throwing'.-instance (HasClient (Throwing '[e] :> api)) => HasClient (Throws e :> api) where-  type Client (Throws e :> api) = Client (Throwing '[e] :> api)+instance (RunClient m, HasClient m (Throwing '[e] :> api)) => HasClient m (Throws e :> api) where+  type Client m (Throws e :> api) = Client m (Throwing '[e] :> api)    clientWithRoute-    :: Proxy (Throws e :> api)-    -> Req-    -> Client (Throwing '[e] :> api)-  clientWithRoute Proxy = clientWithRoute (Proxy :: Proxy (Throwing '[e] :> api))+    :: Proxy m+    -> Proxy (Throws e :> api)+    -> Request+    -> Client m (Throwing '[e] :> api)+  clientWithRoute p Proxy = clientWithRoute p (Proxy :: Proxy (Throwing '[e] :> api))  -- | When @'Throwing' es@ comes before a 'Verb', change it into the same 'Verb' -- but returning an @'Envelope' es@.-instance (HasClient (Verb method status ctypes (Envelope es a))) =>-    HasClient (Throwing es :> Verb method status ctypes a) where+instance (HasClient m (Verb method status ctypes (Envelope es a))) =>+    HasClient m (Throwing es :> Verb method status ctypes a) where -  type Client (Throwing es :> Verb method status ctypes a) =-    Client (Verb method status ctypes (Envelope es a))+  type Client m (Throwing es :> Verb method status ctypes a) =+    Client m (Verb method status ctypes (Envelope es a))    clientWithRoute-    :: Proxy (Throwing es :> Verb method status ctypes a)-    -> Req-    -> Client (Verb method status ctypes (Envelope es a))-  clientWithRoute Proxy =-    clientWithRoute (Proxy :: Proxy (Verb method status ctypes (Envelope es a)))+    :: Proxy m+    -> Proxy (Throwing es :> Verb method status ctypes a)+    -> Request+    -> Client m (Verb method status ctypes (Envelope es a))+  clientWithRoute p Proxy =+    clientWithRoute p (Proxy :: Proxy (Verb method status ctypes (Envelope es a)))  -- | When 'NoThrow' comes before a 'Verb', change it into the same 'Verb' -- but returning an @'Envelope' \'[]@.-instance (HasClient (Verb method status ctypes (Envelope '[] a))) =>-    HasClient (NoThrow :> Verb method status ctypes a) where+instance (RunClient m, HasClient m (Verb method status ctypes (Envelope '[] a))) =>+    HasClient m (NoThrow :> Verb method status ctypes a) where -  type Client (NoThrow :> Verb method status ctypes a) =-    Client (Verb method status ctypes (Envelope '[] a))+  type Client m (NoThrow :> Verb method status ctypes a) =+    Client m (Verb method status ctypes (Envelope '[] a))    clientWithRoute-    :: Proxy (NoThrow :> Verb method status ctypes a)-    -> Req-    -> Client (Verb method status ctypes (Envelope '[] a))-  clientWithRoute Proxy =-    clientWithRoute (Proxy :: Proxy (Verb method status ctypes (Envelope '[] a)))+    :: Proxy m+    -> Proxy (NoThrow :> Verb method status ctypes a)+    -> Request+    -> Client m (Verb method status ctypes (Envelope '[] a))+  clientWithRoute p Proxy =+    clientWithRoute p (Proxy :: Proxy (Verb method status ctypes (Envelope '[] a)))  -- | When @'Throwing' es@ comes before ':<|>', push @'Throwing' es@ into each -- branch of the API.-instance HasClient ((Throwing es :> api1) :<|> (Throwing es :> api2)) =>-    HasClient (Throwing es :> (api1 :<|> api2)) where+instance (RunClient m, HasClient m ((Throwing es :> api1) :<|> (Throwing es :> api2))) =>+    HasClient m (Throwing es :> (api1 :<|> api2)) where -  type Client (Throwing es :> (api1 :<|> api2)) =-    Client ((Throwing es :> api1) :<|> (Throwing es :> api2))+  type Client m (Throwing es :> (api1 :<|> api2)) =+    Client m ((Throwing es :> api1) :<|> (Throwing es :> api2))    clientWithRoute-    :: Proxy (Throwing es :> (api1 :<|> api2))-    -> Req-    -> Client ((Throwing es :> api1) :<|> (Throwing es :> api2))-  clientWithRoute _ =-    clientWithRoute (Proxy :: Proxy ((Throwing es :> api1) :<|> (Throwing es :> api2)))+    :: Proxy m+    -> Proxy (Throwing es :> (api1 :<|> api2))+    -> Request+    -> Client m ((Throwing es :> api1) :<|> (Throwing es :> api2))+  clientWithRoute p _ =+    clientWithRoute p (Proxy :: Proxy ((Throwing es :> api1) :<|> (Throwing es :> api2)))  -- | When 'NoThrow' comes before ':<|>', push 'NoThrow' into each branch of the -- API.-instance HasClient ((NoThrow :> api1) :<|> (NoThrow :> api2)) =>-    HasClient (NoThrow :> (api1 :<|> api2)) where+instance (RunClient m, HasClient m ((NoThrow :> api1) :<|> (NoThrow :> api2))) =>+    HasClient m (NoThrow :> (api1 :<|> api2)) where -  type Client (NoThrow :> (api1 :<|> api2)) =-    Client ((NoThrow :> api1) :<|> (NoThrow :> api2))+  type Client m (NoThrow :> (api1 :<|> api2)) =+    Client m ((NoThrow :> api1) :<|> (NoThrow :> api2))    clientWithRoute-    :: Proxy (NoThrow :> (api1 :<|> api2))-    -> Req-    -> Client ((NoThrow :> api1) :<|> (NoThrow :> api2))-  clientWithRoute _ =-    clientWithRoute (Proxy :: Proxy ((NoThrow :> api1) :<|> (NoThrow :> api2)))+    :: Proxy m+    -> Proxy (NoThrow :> (api1 :<|> api2))+    -> Request+    -> Client m ((NoThrow :> api1) :<|> (NoThrow :> api2))+  clientWithRoute p _ =+    clientWithRoute p (Proxy :: Proxy ((NoThrow :> api1) :<|> (NoThrow :> api2)))  -- | When a @'Throws' e@ comes immediately after a @'Throwing' es@, 'Snoc' the -- @e@ onto the @es@. Otherwise, if @'Throws' e@ comes before any other -- combinator, push it down so it is closer to the 'Verb'.-instance HasClient (ThrowingNonterminal (Throwing es :> api :> apis)) =>-    HasClient (Throwing es :> api :> apis) where+instance (RunClient m, HasClient m (ThrowingNonterminal (Throwing es :> api :> apis))) =>+    HasClient m (Throwing es :> api :> apis) where -  type Client (Throwing es :> api :> apis) =-    Client (ThrowingNonterminal (Throwing es :> api :> apis))+  type Client m (Throwing es :> api :> apis) =+    Client m (ThrowingNonterminal (Throwing es :> api :> apis))    clientWithRoute-    :: Proxy (Throwing es :> api :> apis)-    -> Req-    -> Client (ThrowingNonterminal (Throwing es :> api :> apis))-  clientWithRoute _ =-    clientWithRoute (Proxy :: Proxy (ThrowingNonterminal (Throwing es :> api :> apis)))+    :: Proxy m+    -> Proxy (Throwing es :> api :> apis)+    -> Request+    -> Client m (ThrowingNonterminal (Throwing es :> api :> apis))+  clientWithRoute p _ =+    clientWithRoute p (Proxy :: Proxy (ThrowingNonterminal (Throwing es :> api :> apis)))  -- | When 'NoThrow' comes before any other combinator, push it down so it is -- closer to the 'Verb'.-instance HasClient (api :> NoThrow :> apis) =>-    HasClient (NoThrow :> api :> apis) where+instance (RunClient m, HasClient m (api :> NoThrow :> apis)) =>+    HasClient m (NoThrow :> api :> apis) where -  type Client (NoThrow :> api :> apis) =-    Client (api :> NoThrow :> apis)+  type Client m (NoThrow :> api :> apis) =+    Client m (api :> NoThrow :> apis)    clientWithRoute-    :: Proxy (NoThrow :> api :> apis)-    -> Req-    -> Client (api :> NoThrow :> apis)-  clientWithRoute _ =-    clientWithRoute (Proxy :: Proxy (api :> NoThrow :> apis))+    :: Proxy m+    -> Proxy (NoThrow :> api :> apis)+    -> Request+    -> Client m (api :> NoThrow :> apis)+  clientWithRoute p _ =+    clientWithRoute p (Proxy :: Proxy (api :> NoThrow :> apis))
src/Servant/Checked/Exceptions/Internal/Servant/Server.hs view
@@ -40,7 +40,7 @@ import Servant.Server.Internal.Router (Router, Router', leafRouter) import Servant.Server.Internal.RoutingApplication -- (Delayed, DelayedIO, RouteResult(FailFatal, Route), addAcceptCheck, addMethodCheck, runAction) import Servant-  ( (:<|>)+  ( (:<|>)(..)   , (:>)   , Context   , Handler@@ -76,6 +76,9 @@   type ServerT (Throws e :> api) m =     ServerT (Throwing '[e] :> api) m +  hoistServerWithContext _ pc nt s =+    hoistServerWithContext (Proxy :: Proxy (Throwing '[e] :> api)) pc nt s+   route     :: Proxy (Throws e :> api)     -> Context context@@ -91,6 +94,9 @@   type ServerT (Throwing es :> Verb method status ctypes a) m =     ServerT (VerbWithErr method status ctypes es a) m +  hoistServerWithContext _ =+    hoistServerWithContext (Proxy :: Proxy (VerbWithErr method status ctypes es a))+   route     :: Proxy (Throwing es :> Verb method status ctypes a)     -> Context context@@ -111,6 +117,9 @@   type ServerT (NoThrow :> Verb method status ctypes a) m =     ServerT (VerbWithErr method status ctypes '[] a) m +  hoistServerWithContext _ =+    hoistServerWithContext (Proxy :: Proxy (VerbWithErr method status ctypes '[] a))+   route     :: Proxy (NoThrow :> Verb method status ctypes a)     -> Context context@@ -126,6 +135,9 @@   type ServerT (Throwing es :> (api1 :<|> api2)) m =     ServerT ((Throwing es :> api1) :<|> (Throwing es :> api2)) m +  hoistServerWithContext _ =+    hoistServerWithContext (Proxy :: Proxy ((Throwing es :> api1) :<|> (Throwing es :> api2)))+   route     :: Proxy (Throwing es :> (api1 :<|> api2))     -> Context context@@ -141,6 +153,9 @@   type ServerT (NoThrow :> (api1 :<|> api2)) m =     ServerT ((NoThrow :> api1) :<|> (NoThrow :> api2)) m +  hoistServerWithContext _ =+    hoistServerWithContext (Proxy :: Proxy ((NoThrow :> api1) :<|> (NoThrow :> api2)))+   route     :: Proxy (NoThrow :> (api1 :<|> api2))     -> Context context@@ -157,6 +172,9 @@   type ServerT (Throwing es :> api :> apis) m =     ServerT (ThrowingNonterminal (Throwing es :> api :> apis)) m +  hoistServerWithContext _ =+    hoistServerWithContext (Proxy :: Proxy (ThrowingNonterminal (Throwing es :> api :> apis)))+   route     :: Proxy (Throwing es :> api :> apis)     -> Context context@@ -172,6 +190,9 @@   type ServerT (NoThrow :> api :> apis) m =     ServerT (api :> NoThrow :> apis) m +  hoistServerWithContext _ =+    hoistServerWithContext (Proxy :: Proxy (api :> NoThrow :> apis))+   route     :: Proxy (NoThrow :> api :> apis)     -> Context context@@ -194,6 +215,8 @@    type ServerT (VerbWithErr method successStatus ctypes es a) m =     m (Envelope es a)++  hoistServerWithContext _ _ nt s = nt s    route     :: Proxy (VerbWithErr method successStatus ctypes es a)
stack.yaml view
@@ -1,7 +1,7 @@ # For more information, see: http://docs.haskellstack.org/en/stable/yaml_configuration.html  # Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)-resolver: lts-10.5+resolver: nightly-2018-02-26  # Local packages, usually specified by relative directory name packages: