Ok, so I am heading to a headache...<br><br>Daniel Fischer mentioned a solution using Type Families. As I read, those are meant to replace the FunDeps, I will try this solution...<br><br><div class="gmail_quote">2010/4/17 Casey McCann <span dir="ltr"><<a href="mailto:syntaxglitch@gmail.com">syntaxglitch@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On Sat, Apr 17, 2010 at 4:01 PM, Limestraël <<a href="mailto:limestrael@gmail.com">limestrael@gmail.com</a>> wrote:<br>
> I would have undestood the error if GameObject was also an instance of<br>
> Binary (then the two instances would match), but it's not the case...<br>
<br>
</div>As Daniel Fischer has mentioned, presumably a Binary instance could<br>
later be written for GameObject; even if you have no intention of<br>
doing so, GHC considers the possibility. In other words, it's<br>
sufficient that such an instance could exist, not that it actually<br>
does.<br>
<br>
In general: Instance selection and context checking are separate and<br>
occur in that order, thus contexts generally can't influence instance<br>
selection (except by using OverlappingInstances and strategically<br>
confusing instance heads, ensuring that GHC can't make any sense of<br>
your code until considering the contexts).<br>
<br>
Unfortunately, anything involving extremely generic instances with<br>
some constraint tend to be very difficult to construct, because of how<br>
this works. This tends to include things like default instances for<br>
types not covered by specific ones, making all instances of X also<br>
instances of Y, fundep "type predicates" based on class membership,<br>
and so on. Type hackery can often get you most of what you want, but<br>
it gets awkward fast.<br>
<font color="#888888"><br>
- C.<br>
</font></blockquote></div><br>