[Haskell-cafe] Could not deduce ... using functional dependencies with GHC7

Iavor Diatchki iavor.diatchki at gmail.com
Fri Mar 18 16:19:32 CET 2011


Hi,
that's a bug in GHC---it erroneously accepts polymorphic instances which
violate the FD of a class.
-Iavor

On Fri, Mar 18, 2011 at 7:08 AM, Daniel Fischer <
daniel.is.fischer at googlemail.com> wrote:

> On Friday 18 March 2011 14:40:40, JP Moresmau wrote:
> > Thanks to you all, I think I understand better.
> > instance Search Id Id where
> >   search _ _ i = only (FoundId i)
> >
> > Is too restrictive on the first type, so declaring instead:
> > instance Search id Id where
> >   search _ _ i = only (FoundId i)
>
> Not sure what GHC does with that, but at least in spirit that violates the
> FunDep of
>
> class Search id a | a -> id where ...
>
> Even if it works now, it may well not work in the future.
> I'd go for a more stable solution respecting the intent of FunDeps
> (i.e. there should only be one type t with an instance Search t Id).
>
> >
> > Fixed the issue!! Now the initial "id" is not Id and everybody is
> > happy (and the code still seems to work as intended)
> >
> > thanks again
> >
> > JP
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110318/2a4e1a85/attachment.htm>


More information about the Haskell-Cafe mailing list