Hello oleg, Wednesday, October 11, 2006, 6:45:28 AM, you wrote:
>> instance (Monad m, HSequence m HNil HNil) => HSequence m HNil HNil >> where hSequence _ = return HNil >> >> how can i use the goal of the declaration as one of the conditions >> without causing some sort of black hole in the type inference >> algorithm? > Very easily: the instance head is implicitly the part of its own > context (so that a method can be recursive). as an example: data T = C instance Eq T where C==C = True (/=) = not (==) instance declarations may be even mutually recursive: instance Eq T where a==b = compare a b == EQ instance Ord T where compare a b = EQ a<b = compare a b == LT a<=b = (a<b) || (a==b) -- Best regards, Bulat mailto:[EMAIL PROTECTED] _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
