Skip to content

Commit

Permalink
Version gate RawM and WithResource instances
Browse files Browse the repository at this point in the history
  • Loading branch information
HanStolpo committed Nov 25, 2024
1 parent d3be720 commit 7faa7c2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/Prometheus/Servant/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 7faa7c2

Please sign in to comment.