{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
module Hercules.API.Servant
( noContent,
useApi,
useApiE,
enterApi,
enterApiE,
Substitute,
Placeholder,
)
where
import Control.Monad (void)
import Servant.API
import Servant.API.Generic
import Prelude
useApi ::
forall subapi api mode.
(GenericServant api mode, GenericServant subapi mode) =>
(api mode -> ToServant subapi mode) ->
api mode ->
subapi mode
useApi :: (api mode -> ToServant subapi mode) -> api mode -> subapi mode
useApi = (ToServant subapi mode -> subapi mode
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
Servant.API.Generic.fromServant (ToServant subapi mode -> subapi mode)
-> (api mode -> ToServant subapi mode) -> api mode -> subapi mode
forall b c a. (b -> c) -> (a -> b) -> a -> c
.)
useApiE ::
forall subapi api mode a.
(GenericServant (api a) mode, GenericServant (subapi a) mode) =>
(api a mode -> ToServant (subapi a) mode) ->
api a mode ->
subapi a mode
useApiE :: (api a mode -> ToServant (subapi a) mode)
-> api a mode -> subapi a mode
useApiE = (api a mode -> ToServant (subapi a) mode)
-> api a mode -> subapi a mode
forall (subapi :: * -> *) (api :: * -> *) mode.
(GenericServant api mode, GenericServant subapi mode) =>
(api mode -> ToServant subapi mode) -> api mode -> subapi mode
useApi
enterApi ::
forall subapi api mode.
(GenericServant api mode, GenericServant subapi mode) =>
api mode ->
(api mode -> ToServant subapi mode) ->
subapi mode
enterApi :: api mode -> (api mode -> ToServant subapi mode) -> subapi mode
enterApi = ((api mode -> ToServant subapi mode) -> api mode -> subapi mode)
-> api mode -> (api mode -> ToServant subapi mode) -> subapi mode
forall a b c. (a -> b -> c) -> b -> a -> c
flip (api mode -> ToServant subapi mode) -> api mode -> subapi mode
forall (subapi :: * -> *) (api :: * -> *) mode.
(GenericServant api mode, GenericServant subapi mode) =>
(api mode -> ToServant subapi mode) -> api mode -> subapi mode
useApi
enterApiE ::
forall subapi api mode a.
(GenericServant (api a) mode, GenericServant (subapi a) mode) =>
api a mode ->
(api a mode -> ToServant (subapi a) mode) ->
subapi a mode
enterApiE :: api a mode
-> (api a mode -> ToServant (subapi a) mode) -> subapi a mode
enterApiE = ((api a mode -> ToServant (subapi a) mode)
-> api a mode -> subapi a mode)
-> api a mode
-> (api a mode -> ToServant (subapi a) mode)
-> subapi a mode
forall a b c. (a -> b -> c) -> b -> a -> c
flip (api a mode -> ToServant (subapi a) mode)
-> api a mode -> subapi a mode
forall (subapi :: * -> *) (api :: * -> *) mode.
(GenericServant api mode, GenericServant subapi mode) =>
(api mode -> ToServant subapi mode) -> api mode -> subapi mode
useApi
noContent :: Functor m => m Servant.API.NoContent -> m ()
noContent :: m NoContent -> m ()
noContent = m NoContent -> m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void
data Placeholder
type family Substitute (target :: k) subapi :: *
type instance Substitute Placeholder subapi = subapi
type instance Substitute (a :> b) subapi = a :> Substitute b subapi
type instance Substitute (a :<|> b) subapi = Substitute a subapi :<|> Substitute b subapi