Created
August 17, 2014 13:27
-
-
Save Shimuuar/d45bcecbd4ead77ee34a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
module TySet where | |
type InsertRes x set = If (Member x set) set (x ': set) | |
type family If f a b where | |
If True a b = a | |
If False a b = b | |
type family Member (x :: α) (set :: [α]) :: Bool where | |
Member x '[] = False | |
Member x (x ': xs) = True | |
Member x (y ': xs) = Member x xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment