[Haskell-cafe] Why do I need UndecidableInstances?
Alejandro Serrano Mena
trupill at gmail.com
Thu Oct 24 10:37:15 UTC 2013
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 :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131024/0972e261/attachment.html>
More information about the Haskell-Cafe
mailing list