SPJ:
> Alex: can you flesh out your example any more? I was expecting
> Num (s n) not Num [s n], for example.
The idea is to generalise numeric operations from sets (intervals say),
to sets of sets (lists of intervals). If it were possible to write Set
as a unary class, the instance declaration would be something like:
instance (Set s, Num s, POrd s => Num [s] where
...
But because Set has to be a MPC, it ends up having to be written as:
instance (Set s n, Num (s n), POrd (s n)) => Num [s n] where
...
And of course, there's a whole slew of other very similar looking
instances with different heads, up to and including such head-thumpers
as:
instance (Show (s e), Eq (s e), POrd (s e), Set s e) => Set [] (s e)
More grubby code details available on request, if you think it'd
help. I'm not sure if my idiom makes the most sense, I'm still
feeling my way with this stuff.
> One possible choice would be to insist that the context of
> an instance decl constrained only proper sub-expressions of
> the type on the RHS.
That seems at least a useful step in envelope-pushing. (But just
give us an inch...)
Slainte,
Alex.