From ad27e74273cfe506031e85d44858cce971189bbf Mon Sep 17 00:00:00 2001 From: iko Date: Fri, 3 Feb 2023 07:08:26 +0300 Subject: [PATCH] Added NamedRoutes to servant-foreign --- servant-foreign/src/Servant/Foreign/Internal.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/servant-foreign/src/Servant/Foreign/Internal.hs b/servant-foreign/src/Servant/Foreign/Internal.hs index a184347c..71f1c9a0 100644 --- a/servant-foreign/src/Servant/Foreign/Internal.hs +++ b/servant-foreign/src/Servant/Foreign/Internal.hs @@ -515,6 +515,13 @@ instance HasForeign lang ftype api foreignFor lang ftype Proxy req = foreignFor lang ftype (Proxy :: Proxy api) req +instance HasForeign lang ftype (ToServantApi r) => HasForeign lang ftype (NamedRoutes r) where + type Foreign ftype (NamedRoutes r) = Foreign ftype (ToServantApi r) + + foreignFor lang ftype Proxy req = + foreignFor lang ftype (Proxy :: Proxy (ToServantApi r)) req + + -- | Utility class used by 'listFromAPI' which computes -- the data needed to generate a function for each endpoint -- and hands it all back in a list.