At Sat, 29 Sep 2012 10:56:29 +0200, Francesco Mazzoli wrote: > > At Sat, 29 Sep 2012 10:30:07 +0200, > Francesco Mazzoli wrote: > > Then I'd also like to have > > > > newtype TST sym algo = <...> > > > > instance (Ord sym, ListLike full sym) => Search (TST sym algo) full algo > > > > This one is a different problem - it requires UndecidableInstances and I > > don't > > understand why. It seems to me that the coverage condition > > (<http://www.haskell.org/ghc/docs/latest/html/users_guide/type-class-extensions.html>, > > point 7.6.3.2) is too strict in these cases. But this is not that > > important. > > This doesn't make sense with the code posted (which would require sensibly > UndecidableInstances), I meant something like this (I don't have "actual" code > to show the problem): > > data Foo a > > class Bar a b | a -> b > > class Quux a b | a -> b > > instance Bar a b => Quux (Foo a) b
Actually I know why this is the case - instances are picked without looking at the constraints, and there is no backtracking. I guess my brain just can't resist from seeing Prolog in type classes... -- Francesco * Often in error, never in doubt _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe