This commit is contained in:
Ingy döt Net 2013-04-10 16:57:12 -07:00
parent 518da4a923
commit 764da6cbbb
6144 changed files with 83610 additions and 11 deletions

View file

@ -0,0 +1,2 @@
class Eatable a where
eat :: a -> String

View file

@ -0,0 +1 @@
data (Eatable a) => FoodBox a = F [a]

View file

@ -0,0 +1,3 @@
data Banana = Foo -- the implementation doesn't really matter in this case
instance Eatable Banana where
eat _ = "I'm eating a banana"

View file

@ -0,0 +1,2 @@
instance Eatable Double where
eat d = "I'm eating " ++ show d

View file

@ -0,0 +1,2 @@
class Food a where
munch :: a -> String

View file

@ -0,0 +1,2 @@
instance (Food a) => Eatable a where
eat x = munch x