
On Tue, Nov 2, 2010 at 12:32 AM, Yves Parès
I understand your point Ryan, but in that case, why didn't the error occur when Resource and ResourceId were separated classes?
Because there was only one "retrieveLoc" for a particular IdOf, even if resources shared an IdOf. i.e. instance ResourceId Int where type CfgOf Int = () type LocOf Int = String retreiveLoc () n = "IntId " ++ show n instance Resource () where type IdOf () = Int instance Resource Int where type IdOf Int = Int In this case retrieveLoc () (5 :: Int) = "IntId 5" without any ambiguity, whereas when it was all one class there could be a different method to retrieve the location for () and Int even if IdOf was both Int.
BTW, I assume for your Int instance of Resource, you meant:
instance Resource Int where type IdOf Int = Int type LocOf Int = String type CfgOf Int = ()
Yes, that's correct. Oops. -- ryan