hercules-ci-api-core-0.1.3.0: Types and convenience modules use across Hercules CI API packages
Safe HaskellNone
LanguageHaskell2010

Hercules.API.Servant

Description

Extras for working with servant

Synopsis

Documentation

noContent :: Functor m => m NoContent -> m () Source #

void specialised to NoContent to soothe the compiler that rightfully warns about throwing away a do notation result. By specialising, we make sure that we still get warnings if the result type changes in the future. (We'll get an error)

Generic

useApi :: forall subapi api mode. (GenericServant api mode, GenericServant subapi mode) => (api mode -> ToServant subapi mode) -> api mode -> subapi mode Source #

Postcomposes fromServant to an accessor, preserving the mode parameter, because otherwise the mode parameter can not be inferred.

Ideally, this functionality would be built into a new combinator.

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 Source #

Like useApi but constrains the auth type variable that's passed to subapis.

enterApi :: forall subapi api mode. (GenericServant api mode, GenericServant subapi mode) => api mode -> (api mode -> ToServant subapi mode) -> subapi mode Source #

@flip 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 Source #

@flip useApiE

Substitution

type family Substitute (target :: k) subapi :: * Source #

Replaces Placeholder by subapi in the API target.

Instances

Instances details
type Substitute Placeholder subapi Source # 
Instance details

Defined in Hercules.API.Servant

type Substitute Placeholder subapi = subapi
type Substitute (a :<|> b :: Type) subapi Source # 
Instance details

Defined in Hercules.API.Servant

type Substitute (a :<|> b :: Type) subapi = Substitute a subapi :<|> Substitute b subapi
type Substitute (a :> b :: Type) subapi Source # 
Instance details

Defined in Hercules.API.Servant

type Substitute (a :> b :: Type) subapi = a :> Substitute b subapi

data Placeholder Source #

A reference to the subapi parameter in Substitute

Instances

Instances details
type Substitute Placeholder subapi Source # 
Instance details

Defined in Hercules.API.Servant

type Substitute Placeholder subapi = subapi