
30 May
2012
30 May
'12
4:31 p.m.
Hello, I disagree with your example.
1. Check that an instance is consistent with itself. For example, this should be rejected:
instance C a b
because it allows C Int Bool and C Int Char which violate the functional dependency.
Functional dependencies are not used to pick types, they are used to pick instances. class C a b | a → b where k ∷ a f ∷ a → Maybe b The functional dependency allows you to have a method such as k that doesn't use all the arguments of the class. I expect to be able to make a instance that works for any b. instance C Int b where k = 2 f _ = Nothing Etienne Laurin