[Haskell-cafe] Class constraints with "free" type variables and fundeps

Francesco Mazzoli f at mazzo.li
Sat Sep 29 10:56:29 CEST 2012


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

--
Francesco * Often in error, never in doubt



More information about the Haskell-Cafe mailing list