From 7faa7c2f3e5d4a1e0058305a2804b1a79be22c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Handr=C3=A9=20Stolp?= Date: Mon, 25 Nov 2024 13:03:17 +0000 Subject: [PATCH] Version gate RawM and WithResource instances --- lib/Prometheus/Servant/Internal.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Prometheus/Servant/Internal.hs b/lib/Prometheus/Servant/Internal.hs index d9d2576..6997fd7 100644 --- a/lib/Prometheus/Servant/Internal.hs +++ b/lib/Prometheus/Servant/Internal.hs @@ -224,11 +224,6 @@ instance HasEndpoint Raw where enumerateEndpoints _ = [Endpoint [] "RAW"] -instance HasEndpoint RawM where - getEndpoint _ _ = Just (Endpoint [] "RAW") - - enumerateEndpoints _ = [Endpoint [] "RAW"] - instance HasEndpoint (sub :: Type) => HasEndpoint (CaptureAll (h :: Symbol) a :> sub) where getEndpoint _ req = case pathInfo req of @@ -246,7 +241,14 @@ instance HasEndpoint (sub :: Type) => HasEndpoint (BasicAuth (realm :: Symbol) a enumerateEndpoints _ = enumerateEndpoints (Proxy :: Proxy sub) +#if MIN_VERSION_servant(0,2,0) instance HasEndpoint (sub :: Type) => HasEndpoint (WithResource a :> sub) where getEndpoint _ = getEndpoint (Proxy :: Proxy sub) enumerateEndpoints _ = enumerateEndpoints (Proxy :: Proxy sub) + +instance HasEndpoint RawM where + getEndpoint _ _ = Just (Endpoint [] "RAW") + + enumerateEndpoints _ = [Endpoint [] "RAW"] +#endif