
24 Oct
2013
24 Oct
'13
6:37 a.m.
Dear café, I'm trying to compile a set of simple examples using Functional Dependencies. One of the first ones is the case of natural numbers, which I've defined along with some operations as: data Zero data Succ a class Plus x y z | x y -> z instance Plus Zero x x instance Plus x y z => Plus (Succ x) y (Succ z) class Max x y z | x y -> z instance Max Zero y y instance Max (Succ x) Zero (Succ x) instance Max x y z => Max (Succ x) (Succ y) (Succ z) I thought the compiler would accept this only with the extensions EmptyDataDecls, MultiParamTypeClasses, FunctionalDependencies and FlexibleInstances. But, to my surprise, GHC is also asking me for UndecidableInstances. Why is this the case? Thanks in advance :)