
18 Mar
2011
18 Mar
'11
10:08 a.m.
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