Safe Haskell | None |
---|---|
Language | Haskell2010 |
Servant.Server.Internal
Synopsis
- type Server (api :: k) = ServerT api Handler
- class HasServer (api :: k) (context :: [Type]) where
- data EmptyServer = EmptyServer
- emptyServer :: forall (m :: Type -> Type). ServerT EmptyAPI m
- getAcceptHeader :: Request -> AcceptHeader
- data AsServerT (m :: Type -> Type)
- type AsServer = AsServerT Handler
- type family ServerT (api :: k) (m :: Type -> Type)
- acceptCheck :: forall (list :: [Type]). AllMime list => Proxy list -> AcceptHeader -> DelayedIO ()
- allowedMethodHead :: Method -> Request -> Bool
- methodCheck :: Method -> Request -> DelayedIO ()
- allowedMethod :: Method -> Request -> Bool
- methodRouter :: forall (ctypes :: [Type]) a b env. AllCTRender ctypes a => (b -> ([(HeaderName, ByteString)], a)) -> Method -> Proxy ctypes -> Status -> Delayed env (Handler b) -> Router env
- noContentRouter :: Method -> Status -> Delayed env (Handler b) -> Router env
- streamRouter :: forall {k1} {k2} (ctype :: k1) a c chunk env (framing :: k2). (MimeRender ctype chunk, FramingRender framing, ToSourceIO chunk a) => (c -> ([(HeaderName, ByteString)], a)) -> Method -> Status -> Proxy framing -> Proxy ctype -> Delayed env (Handler c) -> Router env
- parseDeepParam :: (Text, Maybe Text) -> Either String ([Text], Maybe Text)
- ct_wildcard :: ByteString
- type HasServerArrowTypeError (a :: t) (b :: t1) = ((('Text "No instance HasServer (a -> b)." ':$$: 'Text "Maybe you have used '->' instead of ':>' between ") ':$$: 'ShowType a) ':$$: 'Text "and") ':$$: 'ShowType b
- type GServerConstraints (api :: Type -> Type) (m :: Type -> Type) = (ToServant api (AsServerT m) ~ ServerT (ToServantApi api) m, GServantProduct (Rep (api (AsServerT m))))
- class GServer (api :: Type -> Type) (m :: Type -> Type) where
- gServerProof :: Dict (GServerConstraints api m)
- module Servant.Server.Internal.BasicAuth
- module Servant.Server.Internal.Context
- module Servant.Server.Internal.Delayed
- module Servant.Server.Internal.DelayedIO
- module Servant.Server.Internal.ErrorFormatter
- module Servant.Server.Internal.Handler
- module Servant.Server.Internal.Router
- module Servant.Server.Internal.RouteResult
- module Servant.Server.Internal.RoutingApplication
- module Servant.Server.Internal.ServerError
Documentation
class HasServer (api :: k) (context :: [Type]) where #
Associated Types
type ServerT (api :: k) (m :: Type -> Type) #
The type of a server for this API, given a monad to run effects in.
Note that the result kind is *
, so it is not a monad transformer, unlike
what the T
in the name might suggest.
Methods
route :: Proxy api -> Context context -> Delayed env (Server api) -> Router env #
hoistServerWithContext :: Proxy api -> Proxy context -> (forall x. m x -> n x) -> ServerT api m -> ServerT api n #
Instances
HasServer EmptyAPI context # | The server for an type MyApi = "nothing" :> EmptyApi server :: Server MyApi server = emptyServer | ||||
Defined in Servant.Server.Internal Associated Types
| |||||
HasServer Raw context # | Just pass the request to the underlying application and serve its response. Example: type MyApi = "images" :> Raw server :: Server MyApi server = serveDirectory "/var/www/images" | ||||
Defined in Servant.Server.Internal Associated Types
| |||||
HasServer RawM context # | Just pass the request to the underlying application and serve its response. Example: type MyApi = "images" :> Raw server :: Server MyApi server = serveDirectory "/var/www/images" | ||||
Defined in Servant.Server.Internal Associated Types
| |||||
(TypeError (NoInstanceFor (HasServer api context)) :: Constraint) => HasServer (api :: k) context # | |||||
(HasServer (ToServantApi api) context, forall (m :: Type -> Type). Generic (api (AsServerT m)), forall (m :: Type -> Type). GServer api m, ErrorIfNoGeneric api) => HasServer (NamedRoutes api :: Type) context # | |||||
Defined in Servant.Server.Internal Methods route :: Proxy (NamedRoutes api) -> Context context -> Delayed env (Server (NamedRoutes api)) -> Router env # hoistServerWithContext :: Proxy (NamedRoutes api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (NamedRoutes api) m -> ServerT (NamedRoutes api) n # | |||||
(HasServer a context, HasServer b context) => HasServer (a :<|> b :: Type) context # | A server for type MyApi = "books" :> Get '[JSON] [Book] -- GET /books :<|> "books" :> ReqBody Book :> Post '[JSON] Book -- POST /books server :: Server MyApi server = listAllBooks :<|> postBook where listAllBooks = ... postBook book = ... | ||||
ReflectMethod method => HasServer (NoContentVerb method :: Type) context # | |||||
Defined in Servant.Server.Internal Methods route :: Proxy (NoContentVerb method) -> Context context -> Delayed env (Server (NoContentVerb method)) -> Router env # hoistServerWithContext :: Proxy (NoContentVerb method) -> Proxy context -> (forall x. m x -> n x) -> ServerT (NoContentVerb method) m -> ServerT (NoContentVerb method) n # | |||||
(TypeError (HasServerArrowTypeError a b) :: Constraint) => HasServer (a -> b :: Type) context # | This instance prevents from accidentally using
| ||||
(TypeError (PartialApplication (HasServer :: Type -> [Type] -> Constraint) arr) :: Constraint) => HasServer (arr :> sub :: Type) context # | |||||
(KnownSymbol path, HasServer api context) => HasServer (path :> api :: Type) context # | Make sure the incoming request starts with | ||||
HasServer api context => HasServer (HttpVersion :> api :: Type) context # | |||||
Defined in Servant.Server.Internal Methods route :: Proxy (HttpVersion :> api) -> Context context -> Delayed env (Server (HttpVersion :> api)) -> Router env # hoistServerWithContext :: Proxy (HttpVersion :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (HttpVersion :> api) m -> ServerT (HttpVersion :> api) n # | |||||
(KnownSymbol realm, HasServer api context, HasContextEntry context (BasicAuthCheck usr)) => HasServer (BasicAuth realm usr :> api :: Type) context # | Basic Authentication | ||||
Defined in Servant.Server.Internal Methods route :: Proxy (BasicAuth realm usr :> api) -> Context context -> Delayed env (Server (BasicAuth realm usr :> api)) -> Router env # hoistServerWithContext :: Proxy (BasicAuth realm usr :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (BasicAuth realm usr :> api) m -> ServerT (BasicAuth realm usr :> api) n # | |||||
(KnownSymbol capture, FromHttpApiData a, Typeable a, HasServer api context, SBoolI (FoldLenient mods), HasContextEntry (MkContextWithErrorFormatter context) ErrorFormatters) => HasServer (Capture' mods capture a :> api :: Type) context # | If you use You can control how it'll be converted from Example: type MyApi = "books" :> Capture "isbn" Text :> Get '[JSON] Book server :: Server MyApi server = getBook where getBook :: Text -> Handler Book getBook isbn = ... | ||||
Defined in Servant.Server.Internal Methods route :: Proxy (Capture' mods capture a :> api) -> Context context -> Delayed env (Server (Capture' mods capture a :> api)) -> Router env # hoistServerWithContext :: Proxy (Capture' mods capture a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (Capture' mods capture a :> api) m -> ServerT (Capture' mods capture a :> api) n # | |||||
(KnownSymbol capture, FromHttpApiData a, Typeable a, HasServer api context, HasContextEntry (MkContextWithErrorFormatter context) ErrorFormatters) => HasServer (CaptureAll capture a :> api :: Type) context # | If you use You can control how they'll be converted from Example: type MyApi = "src" :> CaptureAll "segments" Text :> Get '[JSON] SourceFile server :: Server MyApi server = getSourceFile where getSourceFile :: [Text] -> Handler Book getSourceFile pathSegments = ... | ||||
Defined in Servant.Server.Internal Methods route :: Proxy (CaptureAll capture a :> api) -> Context context -> Delayed env (Server (CaptureAll capture a :> api)) -> Router env # hoistServerWithContext :: Proxy (CaptureAll capture a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (CaptureAll capture a :> api) m -> ServerT (CaptureAll capture a :> api) n # | |||||
HasServer api ctx => HasServer (Description desc :> api :: Type) ctx # | Ignore | ||||
Defined in Servant.Server.Internal Methods route :: Proxy (Description desc :> api) -> Context ctx -> Delayed env (Server (Description desc :> api)) -> Router env # hoistServerWithContext :: Proxy (Description desc :> api) -> Proxy ctx -> (forall x. m x -> n x) -> ServerT (Description desc :> api) m -> ServerT (Description desc :> api) n # | |||||
HasServer api ctx => HasServer (Summary desc :> api :: Type) ctx # | Ignore | ||||
Defined in Servant.Server.Internal | |||||
HasServer api context => HasServer (EmptyAPI :> api :: Type) context # | Ignore | ||||
Defined in Servant.Server.Internal | |||||
(HasServer api context, HasContextEntry context (AuthHandler Request (AuthServerData (AuthProtect tag)))) => HasServer (AuthProtect tag :> api :: Type) context # | Known orphan instance. | ||||
Defined in Servant.Server.Experimental.Auth Methods route :: Proxy (AuthProtect tag :> api) -> Context context -> Delayed env (Server (AuthProtect tag :> api)) -> Router env # hoistServerWithContext :: Proxy (AuthProtect tag :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (AuthProtect tag :> api) m -> ServerT (AuthProtect tag :> api) n # | |||||
(AtMostOneFragment api, FragmentUnique (Fragment a1 :> api), HasServer api context) => HasServer (Fragment a1 :> api :: Type) context # | Ignore Example: type MyApi = "books" :> Fragment Text :> Get '[JSON] [Book] server :: Server MyApi server = getBooks where getBooks :: Handler [Book] getBooks = ...return all books... | ||||
Defined in Servant.Server.Internal | |||||
(KnownSymbol sym, FromHttpApiData a, HasServer api context, SBoolI (FoldRequired mods), SBoolI (FoldLenient mods), HasContextEntry (MkContextWithErrorFormatter context) ErrorFormatters) => HasServer (Header' mods sym a :> api :: Type) context # | If you use All it asks is for a Example: newtype Referer = Referer Text deriving (Eq, Show, FromHttpApiData) -- GET /view-my-referer type MyApi = "view-my-referer" :> Header "Referer" Referer :> Get '[JSON] Referer server :: Server MyApi server = viewReferer where viewReferer :: Referer -> Handler referer viewReferer referer = return referer | ||||
Defined in Servant.Server.Internal Methods route :: Proxy (Header' mods sym a :> api) -> Context context -> Delayed env (Server (Header' mods sym a :> api)) -> Router env # hoistServerWithContext :: Proxy (Header' mods sym a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (Header' mods sym a :> api) m -> ServerT (Header' mods sym a :> api) n # | |||||
HasServer api context => HasServer (IsSecure :> api :: Type) context # | |||||
Defined in Servant.Server.Internal | |||||
(KnownSymbol sym, HasServer api context) => HasServer (QueryFlag sym :> api :: Type) context # | If you use Example: type MyApi = "books" :> QueryFlag "published" :> Get '[JSON] [Book] server :: Server MyApi server = getBooks where getBooks :: Bool -> Handler [Book] getBooks onlyPublished = ...return all books, or only the ones that are already published, depending on the argument... | ||||
Defined in Servant.Server.Internal | |||||
(KnownSymbol sym, FromHttpApiData a, HasServer api context, SBoolI (FoldRequired mods), SBoolI (FoldLenient mods), HasContextEntry (MkContextWithErrorFormatter context) ErrorFormatters) => HasServer (QueryParam' mods sym a :> api :: Type) context # | If you use This lets servant worry about looking it up in the query string
and turning it into a value of the type you specify, enclosed
in You can control how it'll be converted from Example: type MyApi = "books" :> QueryParam "author" Text :> Get '[JSON] [Book] server :: Server MyApi server = getBooksBy where getBooksBy :: Maybe Text -> Handler [Book] getBooksBy Nothing = ...return all books... getBooksBy (Just author) = ...return books by the given author... | ||||
Defined in Servant.Server.Internal Methods route :: Proxy (QueryParam' mods sym a :> api) -> Context context -> Delayed env (Server (QueryParam' mods sym a :> api)) -> Router env # hoistServerWithContext :: Proxy (QueryParam' mods sym a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (QueryParam' mods sym a :> api) m -> ServerT (QueryParam' mods sym a :> api) n # | |||||
(KnownSymbol sym, FromHttpApiData a, HasServer api context, HasContextEntry (MkContextWithErrorFormatter context) ErrorFormatters) => HasServer (QueryParams sym a :> api :: Type) context # | If you use This lets servant worry about looking up 0 or more values in the query string
associated to You can control how the individual values are converted from Example: type MyApi = "books" :> QueryParams "authors" Text :> Get '[JSON] [Book] server :: Server MyApi server = getBooksBy where getBooksBy :: [Text] -> Handler [Book] getBooksBy authors = ...return all books by these authors... | ||||
Defined in Servant.Server.Internal Methods route :: Proxy (QueryParams sym a :> api) -> Context context -> Delayed env (Server (QueryParams sym a :> api)) -> Router env # hoistServerWithContext :: Proxy (QueryParams sym a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (QueryParams sym a :> api) m -> ServerT (QueryParams sym a :> api) n # | |||||
(KnownSymbol sym, FromDeepQuery a, HasServer api context, HasContextEntry (MkContextWithErrorFormatter context) ErrorFormatters) => HasServer (DeepQuery sym a :> api :: Type) context # | If you use This lets you extract an object from multiple parameters in the query string,
with its fields enclosed in brackets: `/books?filter[author][name]=value`. When
all the fields are known in advance, it can be done with The way the object is constructed from the extracted fields can be controlled by
providing an instance on Example: type MyApi = "books" :> DeepQuery "filter" BookQuery :> Get '[JSON] [Book] server :: Server MyApi server = getBooksBy where getBooksBy :: BookQuery -> Handler [Book] getBooksBy query = ...filter books based on the dynamic filters provided... | ||||
Defined in Servant.Server.Internal Methods route :: Proxy (DeepQuery sym a :> api) -> Context context -> Delayed env (Server (DeepQuery sym a :> api)) -> Router env # hoistServerWithContext :: Proxy (DeepQuery sym a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (DeepQuery sym a :> api) m -> ServerT (DeepQuery sym a :> api) n # | |||||
HasServer api context => HasServer (QueryString :> api :: Type) context # | If you use This lets you extract the whole query string. This is useful when the query string
can contain parameters with dynamic names, that you can't access with Example: type MyApi = "books" :> QueryString :> Get '[JSON] [Book] server :: Server MyApi server = getBooksBy where getBooksBy :: Query -> Handler [Book] getBooksBy filters = ...filter books based on the dynamic filters provided... | ||||
Defined in Servant.Server.Internal Methods route :: Proxy (QueryString :> api) -> Context context -> Delayed env (Server (QueryString :> api)) -> Router env # hoistServerWithContext :: Proxy (QueryString :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (QueryString :> api) m -> ServerT (QueryString :> api) n # | |||||
HasServer api context => HasServer (RemoteHost :> api :: Type) context # | |||||
Defined in Servant.Server.Internal Methods route :: Proxy (RemoteHost :> api) -> Context context -> Delayed env (Server (RemoteHost :> api)) -> Router env # hoistServerWithContext :: Proxy (RemoteHost :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (RemoteHost :> api) m -> ServerT (RemoteHost :> api) n # | |||||
(AllCTUnrender list a, HasServer api context, SBoolI (FoldLenient mods), HasContextEntry (MkContextWithErrorFormatter context) ErrorFormatters) => HasServer (ReqBody' mods list a :> api :: Type) context # | If you use All it asks is for a Example: type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book server :: Server MyApi server = postBook where postBook :: Book -> Handler Book postBook book = ...insert into your db... | ||||
Defined in Servant.Server.Internal Methods route :: Proxy (ReqBody' mods list a :> api) -> Context context -> Delayed env (Server (ReqBody' mods list a :> api)) -> Router env # hoistServerWithContext :: Proxy (ReqBody' mods list a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (ReqBody' mods list a :> api) m -> ServerT (ReqBody' mods list a :> api) n # | |||||
(FramingUnrender framing, FromSourceIO chunk a, MimeUnrender ctype chunk, HasServer api context) => HasServer (StreamBody' mods framing ctype a :> api :: Type) context # | |||||
Defined in Servant.Server.Internal Methods route :: Proxy (StreamBody' mods framing ctype a :> api) -> Context context -> Delayed env (Server (StreamBody' mods framing ctype a :> api)) -> Router env # hoistServerWithContext :: Proxy (StreamBody' mods framing ctype a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (StreamBody' mods framing ctype a :> api) m -> ServerT (StreamBody' mods framing ctype a :> api) n # | |||||
(HasServer api ctx, HasContextEntry ctx (Acquire a)) => HasServer (WithResource a :> api :: Type) ctx # | If you use | ||||
Defined in Servant.Server.Internal Methods route :: Proxy (WithResource a :> api) -> Context ctx -> Delayed env (Server (WithResource a :> api)) -> Router env # hoistServerWithContext :: Proxy (WithResource a :> api) -> Proxy ctx -> (forall x. m x -> n x) -> ServerT (WithResource a :> api) m -> ServerT (WithResource a :> api) n # | |||||
HasServer api context => HasServer (Vault :> api :: Type) context # | |||||
(TypeError (NoInstanceForSub (HasServer :: Type -> [Type] -> Constraint) ty) :: Constraint) => HasServer (ty :> sub :: Type) context # | |||||
(ReflectMethod method, AllMime contentTypes, All (IsServerResourceWithStatus contentTypes) as, Unique (Statuses as)) => HasServer (UVerb method contentTypes as :: Type) context # | |||||
Defined in Servant.Server.UVerb Methods route :: Proxy (UVerb method contentTypes as) -> Context context -> Delayed env (Server (UVerb method contentTypes as)) -> Router env # hoistServerWithContext :: Proxy (UVerb method contentTypes as) -> Proxy context -> (forall x. m x -> n x) -> ServerT (UVerb method contentTypes as) m -> ServerT (UVerb method contentTypes as) n # | |||||
(HasContextEntry context (NamedContext name subContext), HasServer subApi subContext) => HasServer (WithNamedContext name subContext subApi :: Type) context # | |||||
Defined in Servant.Server.Internal Methods route :: Proxy (WithNamedContext name subContext subApi) -> Context context -> Delayed env (Server (WithNamedContext name subContext subApi)) -> Router env # hoistServerWithContext :: Proxy (WithNamedContext name subContext subApi) -> Proxy context -> (forall x. m x -> n x) -> ServerT (WithNamedContext name subContext subApi) m -> ServerT (WithNamedContext name subContext subApi) n # | |||||
(AllCTRender ctypes a, ReflectMethod method, KnownNat status, GetHeaders (Headers h a)) => HasServer (Verb method status ctypes (Headers h a) :: Type) context # | |||||
Defined in Servant.Server.Internal Methods route :: Proxy (Verb method status ctypes (Headers h a)) -> Context context -> Delayed env (Server (Verb method status ctypes (Headers h a))) -> Router env # hoistServerWithContext :: Proxy (Verb method status ctypes (Headers h a)) -> Proxy context -> (forall x. m x -> n x) -> ServerT (Verb method status ctypes (Headers h a)) m -> ServerT (Verb method status ctypes (Headers h a)) n # | |||||
(AllCTRender ctypes a, ReflectMethod method, KnownNat status) => HasServer (Verb method status ctypes a :: Type) context # | |||||
Defined in Servant.Server.Internal Methods route :: Proxy (Verb method status ctypes a) -> Context context -> Delayed env (Server (Verb method status ctypes a)) -> Router env # hoistServerWithContext :: Proxy (Verb method status ctypes a) -> Proxy context -> (forall x. m x -> n x) -> ServerT (Verb method status ctypes a) m -> ServerT (Verb method status ctypes a) n # | |||||
(MimeRender ctype chunk, ReflectMethod method, KnownNat status, FramingRender framing, ToSourceIO chunk a, GetHeaders (Headers h a)) => HasServer (Stream method status framing ctype (Headers h a) :: Type) context # | |||||
Defined in Servant.Server.Internal Methods route :: Proxy (Stream method status framing ctype (Headers h a)) -> Context context -> Delayed env (Server (Stream method status framing ctype (Headers h a))) -> Router env # hoistServerWithContext :: Proxy (Stream method status framing ctype (Headers h a)) -> Proxy context -> (forall x. m x -> n x) -> ServerT (Stream method status framing ctype (Headers h a)) m -> ServerT (Stream method status framing ctype (Headers h a)) n # | |||||
(MimeRender ctype chunk, ReflectMethod method, KnownNat status, FramingRender framing, ToSourceIO chunk a) => HasServer (Stream method status framing ctype a :: Type) context # | |||||
Defined in Servant.Server.Internal Methods route :: Proxy (Stream method status framing ctype a) -> Context context -> Delayed env (Server (Stream method status framing ctype a)) -> Router env # hoistServerWithContext :: Proxy (Stream method status framing ctype a) -> Proxy context -> (forall x. m x -> n x) -> ServerT (Stream method status framing ctype a) m -> ServerT (Stream method status framing ctype a) n # |
data EmptyServer #
Singleton type representing a server that serves an empty API.
Constructors
EmptyServer |
Instances
Bounded EmptyServer # | |
Defined in Servant.Server.Internal | |
Enum EmptyServer # | |
Defined in Servant.Server.Internal Methods succ :: EmptyServer -> EmptyServer # pred :: EmptyServer -> EmptyServer # toEnum :: Int -> EmptyServer # fromEnum :: EmptyServer -> Int # enumFrom :: EmptyServer -> [EmptyServer] # enumFromThen :: EmptyServer -> EmptyServer -> [EmptyServer] # enumFromTo :: EmptyServer -> EmptyServer -> [EmptyServer] # enumFromThenTo :: EmptyServer -> EmptyServer -> EmptyServer -> [EmptyServer] # | |
Show EmptyServer # | |
Defined in Servant.Server.Internal Methods showsPrec :: Int -> EmptyServer -> ShowS # show :: EmptyServer -> String # showList :: [EmptyServer] -> ShowS # | |
Eq EmptyServer # | |
Defined in Servant.Server.Internal |
getAcceptHeader :: Request -> AcceptHeader #
data AsServerT (m :: Type -> Type) #
A type that specifies that an API record contains a server implementation.
Instances
GenericMode (AsServerT m :: Type) # | |
Defined in Servant.Server.Internal | |
type (AsServerT m :: Type) :- api # | |
Defined in Servant.Server.Internal |
type family ServerT (api :: k) (m :: Type -> Type) #
The type of a server for this API, given a monad to run effects in.
Note that the result kind is *
, so it is not a monad transformer, unlike
what the T
in the name might suggest.
Instances
acceptCheck :: forall (list :: [Type]). AllMime list => Proxy list -> AcceptHeader -> DelayedIO () #
allowedMethodHead :: Method -> Request -> Bool #
methodCheck :: Method -> Request -> DelayedIO () #
allowedMethod :: Method -> Request -> Bool #
methodRouter :: forall (ctypes :: [Type]) a b env. AllCTRender ctypes a => (b -> ([(HeaderName, ByteString)], a)) -> Method -> Proxy ctypes -> Status -> Delayed env (Handler b) -> Router env #
streamRouter :: forall {k1} {k2} (ctype :: k1) a c chunk env (framing :: k2). (MimeRender ctype chunk, FramingRender framing, ToSourceIO chunk a) => (c -> ([(HeaderName, ByteString)], a)) -> Method -> Status -> Proxy framing -> Proxy ctype -> Delayed env (Handler c) -> Router env #
type HasServerArrowTypeError (a :: t) (b :: t1) = ((('Text "No instance HasServer (a -> b)." ':$$: 'Text "Maybe you have used '->' instead of ':>' between ") ':$$: 'ShowType a) ':$$: 'Text "and") ':$$: 'ShowType b #
type GServerConstraints (api :: Type -> Type) (m :: Type -> Type) = (ToServant api (AsServerT m) ~ ServerT (ToServantApi api) m, GServantProduct (Rep (api (AsServerT m)))) #
Set of constraints required to convert to / from vanilla server types.
class GServer (api :: Type -> Type) (m :: Type -> Type) where #
This class is a necessary evil: in the implementation of HasServer
for
, we essentially need the quantified constraint NamedRoutes
apiforall
m.
to hold.GServerConstraints
m
We cannot require do that directly as the definition of GServerConstraints
contains type family applications (Rep
and ServerT
). The trick is to hide
those type family applications behind a typeclass providing evidence for
in the form of a dictionary, and require that
GServerConstraints
api mforall m.
instead.GServer
api m
Users shouldn't have to worry about this class, as the only possible instance is provided in this module for all record APIs.
Methods
gServerProof :: Dict (GServerConstraints api m) #
Instances
(ToServant api (AsServerT m) ~ ServerT (ToServantApi api) m, GServantProduct (Rep (api (AsServerT m)))) => GServer api m # | |
Defined in Servant.Server.Internal Methods gServerProof :: Dict (GServerConstraints api m) # |