Ivan,
I don't yet know how to explain this formally, but I know how to fix your problem..
You need to add a parameter to the Packet class so the compiler knows what type to use for the Location.
.. The following code works for me.. You'll need to use a compiler/interpreter which supports multi-parameter type classes.. like ghci with the glasgow extensions turned on
----------------------------------------- class Location a where point :: a -> String
class Packet a loc where
source :: Location loc => a -> loc
destination :: Location loc => a -> loc
size :: Num b => a -> b------------------------------------------------------ data TestLocation = TestSource | TestDestination
data TestPacket = TestPacket
------------------------------------------------------
instance Location TestLocation where
point a = "location"instance Packet TestPacket TestLocation
where
source p = TestSource
destination p = TestDestination
size p = 99_______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
