Skip to content

Commit a0834a0

Browse files
committed
Add instance HasServer (EmptyAPI :> api) context
1 parent 45e031e commit a0834a0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

servant-server/src/Servant/Server/Internal.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ instance
641641
--
642642
-- The way the object is constructed from the extracted fields can be controlled by
643643
-- providing an instance on @'FromDeepQuery'@
644-
--
644+
--
645645
-- Example:
646646
--
647647
-- > type MyApi = "books" :> DeepQuery "filter" BookQuery :> Get '[JSON] [Book]
@@ -914,6 +914,13 @@ instance HasServer EmptyAPI context where
914914

915915
hoistServerWithContext _ _ _ = retag
916916

917+
-- | Ignore @'EmptyAPI'@ as part of route in server handlers.
918+
instance HasServer api context => HasServer (EmptyAPI :> api) context where
919+
type ServerT (EmptyAPI :> api) m = ServerT api m
920+
921+
route _ = route (Proxy :: Proxy api)
922+
hoistServerWithContext _ = hoistServerWithContext (Proxy :: Proxy api)
923+
917924
-- | Basic Authentication
918925
instance ( KnownSymbol realm
919926
, HasServer api context

0 commit comments

Comments
 (0)