Norman Ramsey wrote:
data Formula f => Row a = Row (f a, Weight) type Weight = Float
Hugs rejects this program:
ERROR "hard.lhs" (line 14): Undefined type variable "f"
Right, f is not bound in the declaration of Row. Only the occurances of type variables after the type constructor are binding occurances. The fix is to turn Row into a binary constructor:
data Formula f => Row f a = Row (f a, Weight)
BTW, contexts have no real meaning in data declarations - the declaration above does not prevent you from writing
type T = Row [] Int
Cheers, - Andreas -- Andreas Rossberg, rossberg@ps.uni-sb.de "Computer games don't affect kids. If Pac Man affected us as kids, we would all be running around in darkened rooms, munching pills, and listening to repetitive music."