feat: Polymorphic Elem
for Union
(#1637)
Close https://github.com/haskell-servant/servant/issues/1590
This commit is contained in:
parent
6392dce4bf
commit
a4194dc490
1 changed files with 2 additions and 2 deletions
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue