Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. type family Elem (x :: k) (xs :: [k]) :: Bool where
  2. Elem x '[] = 'False
  3. Elem x (x ': xs) = 'True
  4. Elem x (y ': xs) = Elem x xs
  5.  
  6. type family If (condition :: Bool) (t :: k) (e :: k) :: k where
  7. If 'True t e = t
  8. If 'False t e = e
  9.  
  10. type family Without (xs :: [k]) (ys :: [k]) :: [k] where
  11. Without xs '[] = xs
  12. Without '[] ys = '[]
  13. Without (x ': xs) ys = If (x `Elem` ys) (Without xs ys) (x ': Without xs ys)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement