diff --git a/changelog.d/1775 b/changelog.d/1775 new file mode 100644 index 000000000..4bf712116 --- /dev/null +++ b/changelog.d/1775 @@ -0,0 +1,2 @@ +synopsis: Add instance `HasServer (EmptyAPI :> api) context` +prs: #1775 diff --git a/servant-server/src/Servant/Server/Internal.hs b/servant-server/src/Servant/Server/Internal.hs index 965c626f2..a2818d18b 100644 --- a/servant-server/src/Servant/Server/Internal.hs +++ b/servant-server/src/Servant/Server/Internal.hs @@ -641,7 +641,7 @@ instance -- -- The way the object is constructed from the extracted fields can be controlled by -- providing an instance on @'FromDeepQuery'@ --- +-- -- Example: -- -- > type MyApi = "books" :> DeepQuery "filter" BookQuery :> Get '[JSON] [Book] @@ -914,6 +914,13 @@ instance HasServer EmptyAPI context where hoistServerWithContext _ _ _ = retag +-- | Ignore @'EmptyAPI'@ as part of route in server handlers. +instance HasServer api context => HasServer (EmptyAPI :> api) context where + type ServerT (EmptyAPI :> api) m = ServerT api m + + route _ = route (Proxy :: Proxy api) + hoistServerWithContext _ = hoistServerWithContext (Proxy :: Proxy api) + -- | Basic Authentication instance ( KnownSymbol realm , HasServer api context