Skip to content

Commit

Permalink
Add IsIn instance for NamedRoutes (#1707)
Browse files Browse the repository at this point in the history
* Add clause for NamedRoutes in IsIn combinator
  • Loading branch information
Friede80 authored Jan 24, 2024
1 parent 72b7abb commit 33be508
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type family IsIn sub api :: Constraint where
IsIn e (a :<|> b) = Or (IsIn e a) (IsIn e b)
IsIn (e :> a) (e :> b) = IsIn a b
IsIn e e = ()
IsIn e (NamedRoutes record) = IsIn e (ToServantApi record)

-- | Check whether a type is a member of a list of types.
-- This is a type-level analogue of @'elem'@.
Expand Down
1 change: 1 addition & 0 deletions servant/src/Servant/API/TypeLevel.hs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ type family IsIn (endpoint :: Type) (api :: Type) :: Constraint where
IsIn e (sa :<|> sb) = Or (IsIn e sa) (IsIn e sb)
IsIn (e :> sa) (e :> sb) = IsIn sa sb
IsIn e e = ()
IsIn e (NamedRoutes record) = IsIn e (ToServantApi record)

-- | Check whether @sub@ is a sub API of @api@.
--
Expand Down

0 comments on commit 33be508

Please sign in to comment.