Merge pull request #1485 from haskell-servant/rename-proof

Rename proof to g{Client,Server,Link}Proof
This commit is contained in:
Gaël Deest 2021-11-18 10:43:35 +01:00 committed by GitHub
commit 0e41e37c93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View file

@ -828,10 +828,10 @@ type GClientConstraints api m =
) )
class GClient (api :: * -> *) m where class GClient (api :: * -> *) m where
proof :: Dict (GClientConstraints api m) gClientProof :: Dict (GClientConstraints api m)
instance GClientConstraints api m => GClient api m where instance GClientConstraints api m => GClient api m where
proof = Dict gClientProof = Dict
instance instance
( forall n. GClient api n ( forall n. GClient api n
@ -843,7 +843,7 @@ instance
clientWithRoute :: Proxy m -> Proxy (NamedRoutes api) -> Request -> Client m (NamedRoutes api) clientWithRoute :: Proxy m -> Proxy (NamedRoutes api) -> Request -> Client m (NamedRoutes api)
clientWithRoute pm _ request = clientWithRoute pm _ request =
case proof @api @m of case gClientProof @api @m of
Dict -> fromServant $ clientWithRoute pm (Proxy @(ToServantApi api)) request Dict -> fromServant $ clientWithRoute pm (Proxy @(ToServantApi api)) request
hoistClientMonad hoistClientMonad
@ -854,7 +854,7 @@ instance
-> Client ma (NamedRoutes api) -> Client ma (NamedRoutes api)
-> Client mb (NamedRoutes api) -> Client mb (NamedRoutes api)
hoistClientMonad _ _ nat clientA = hoistClientMonad _ _ nat clientA =
case (proof @api @ma, proof @api @mb) of case (gClientProof @api @ma, gClientProof @api @mb) of
(Dict, Dict) -> (Dict, Dict) ->
fromServant @api @(AsClientT mb) $ fromServant @api @(AsClientT mb) $
hoistClientMonad @m @(ToServantApi api) @ma @mb Proxy Proxy nat $ hoistClientMonad @m @(ToServantApi api) @ma @mb Proxy Proxy nat $

View file

@ -928,13 +928,13 @@ type GServerConstraints api m =
-- is provided in this module for all record APIs. -- is provided in this module for all record APIs.
class GServer (api :: * -> *) (m :: * -> *) where class GServer (api :: * -> *) (m :: * -> *) where
proof :: Dict (GServerConstraints api m) gServerProof :: Dict (GServerConstraints api m)
instance instance
( ToServant api (AsServerT m) ~ ServerT (ToServantApi api) m ( ToServant api (AsServerT m) ~ ServerT (ToServantApi api) m
, GServantProduct (Rep (api (AsServerT m))) , GServantProduct (Rep (api (AsServerT m)))
) => GServer api m where ) => GServer api m where
proof = Dict gServerProof = Dict
instance instance
( HasServer (ToServantApi api) context ( HasServer (ToServantApi api) context
@ -950,7 +950,7 @@ instance
-> Delayed env (api (AsServerT Handler)) -> Delayed env (api (AsServerT Handler))
-> Router env -> Router env
route _ ctx delayed = route _ ctx delayed =
case proof @api @Handler of case gServerProof @api @Handler of
Dict -> route (Proxy @(ToServantApi api)) ctx (toServant <$> delayed) Dict -> route (Proxy @(ToServantApi api)) ctx (toServant <$> delayed)
hoistServerWithContext hoistServerWithContext
@ -960,7 +960,7 @@ instance
-> api (AsServerT m) -> api (AsServerT m)
-> api (AsServerT n) -> api (AsServerT n)
hoistServerWithContext _ pctx nat server = hoistServerWithContext _ pctx nat server =
case (proof @api @m, proof @api @n) of case (gServerProof @api @m, gServerProof @api @n) of
(Dict, Dict) -> (Dict, Dict) ->
fromServant servantSrvN fromServant servantSrvN
where where

View file

@ -595,10 +595,10 @@ type GLinkConstraints routes a =
) )
class GLink (routes :: * -> *) (a :: *) where class GLink (routes :: * -> *) (a :: *) where
proof :: Dict (GLinkConstraints routes a) gLinkProof :: Dict (GLinkConstraints routes a)
instance GLinkConstraints routes a => GLink routes a where instance GLinkConstraints routes a => GLink routes a where
proof = Dict gLinkProof = Dict
instance instance
( HasLink (ToServantApi routes) ( HasLink (ToServantApi routes)
@ -613,7 +613,7 @@ instance
-> Link -> Link
-> routes (AsLink a) -> routes (AsLink a)
toLink toA _ l = case proof @routes @a of toLink toA _ l = case gLinkProof @routes @a of
Dict -> fromServant $ toLink toA (Proxy @(ToServantApi routes)) l Dict -> fromServant $ toLink toA (Proxy @(ToServantApi routes)) l
-- AuthProtext instances -- AuthProtext instances