Skip to content

Commit a4194dc

Browse files
authored
feat: Polymorphic Elem for Union (#1637)
Close #1590
1 parent 6392dce commit a4194dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

servant/src/Servant/API/UVerb/Union.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ type DuplicateElementError (rs :: [k]) =
128128
':$$: 'Text " " ':<>: 'ShowType rs
129129

130130
type family Elem (x :: k) (xs :: [k]) :: Bool where
131+
Elem x (x ': _) = 'True
132+
Elem x (_ ': xs) = Elem x xs
131133
Elem _ '[] = 'False
132-
Elem x (x' ': xs) =
133-
If (x == x') 'True (Elem x xs)
134134

135135
type family Unique xs :: Constraint where
136136
Unique xs = If (Nubbed xs == 'True) (() :: Constraint) (TypeError (DuplicateElementError xs))

0 commit comments

Comments
 (0)