Created
August 13, 2014 07:12
-
-
Save ktvoelker/af613fe5308b748b4606 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 TypeFamilies #-} | |
module Set where | |
class Set a where | |
type E a | |
empty :: a | |
insert :: E a -> a -> a | |
member :: E a -> a -> Bool | |
data Tree a = Empty | MkTree (Tree a) a (Tree a) | |
treeEmpty :: Tree a | |
treeEmpty = Empty | |
treeInsert :: Ord a => a -> Tree a -> Tree a | |
treeInsert = undefined | |
treeMember :: Ord a => a -> Tree a -> Bool | |
treeMember = undefined | |
instance Ord a => Set (Tree a) where | |
type E (Tree a) = a | |
empty = treeEmpty | |
insert = treeInsert | |
member = treeMember |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment