On Fri, Jan 22, 2010 at 12:24:37PM +0100, Emil Axelsson wrote:
> Consider the following program:
>
> >{-# LANGUAGE FlexibleInstances, OverlappingInstances, UndecidableInstances
> >#-}
> >class B a => A a
> >
> >instance A Int
> >
> >class Eq a => B a
> >
> >instance (A a, Eq a) => B a
> [...]
> Although I don't know all the details of the class system, it seems
> unintuitive that I can make a program non-terminating just by
> changing the context of a function (regardless of
> UndecidableInstances etc.).
>
> Is this a bug or a feature?
I'm afraid you voided the warranty when you used UndecidableInstances.
You really do have a circularity between A and B here, so it's not
surprising that you get a loop. By changing the context, you demanded
more instances, undecidable ones in fact.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe