[Haskell-cafe] Could not deduce ... using functional dependencies with GHC7
Daniel Fischer
daniel.is.fischer at googlemail.com
Fri Mar 18 15:08:24 CET 2011
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
More information about the Haskell-Cafe
mailing list