Skip to content

Commit

Permalink
feat: Polymorphic Elem for Union (#1637)
Browse files Browse the repository at this point in the history
Close #1590
  • Loading branch information
guibou committed Dec 23, 2022
1 parent 6392dce commit a4194dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions servant/src/Servant/API/UVerb/Union.hs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ type DuplicateElementError (rs :: [k]) =
':$$: 'Text " " ':<>: 'ShowType rs

type family Elem (x :: k) (xs :: [k]) :: Bool where
Elem x (x ': _) = 'True
Elem x (_ ': xs) = Elem x xs
Elem _ '[] = 'False
Elem x (x' ': xs) =
If (x == x') 'True (Elem x xs)

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

0 comments on commit a4194dc

Please sign in to comment.