> Another question on *rules*.
> Could they help the implicit type casting?
> For example, with
> {rules Num a=> x::a, y::[a] ==> x+y = [x]+y}
> instance Num a => Num [a] where ...
> one could expect for x :: Num b=>b the casting
> x + [x,y] --> [x] + [x,y]
>
Provided the two sides of the rules have the same overall type,
GHC will be happy. But since there are no side condition, your
rule will rewrite *every* x+y to [x]+y, which isn't what you
want I guess.
I rather doubt that rules will help you here. Type casting
is the business of the type checker, not an optimiser. The
latter takes a correct program and rewrites it to another correct program
(hopefully).
Simon