Joe writes:
> [My simple syntax for LHSes] doesn't cover things like
>
> (f .* g) x y = f (g x y)
and proposes a syntax which is the same as my simple proposal,
but covers exactly this also.
> lhs ::= (var | @(@ ilhs @)@) apat+
> | ilhs
> | pat
>
> ilhs ::= pat{i+1} varop(n,i) pat{i+1}
> | lpat{i} varop(l,i) pat{i+1}
> | pat{i+1} varop(r,i) rpat{i}
I don't see any major problem with your proposal once the (n+k)
ambiguity is resolved. And it is much easier to understand
than the present syntax.
I could also accept lhs = pat <= exp (now that is simple!). It's
a bit odd to think of
x * f y = e
as a semantic error, but that's largely a question of error reporting,
I suppose.
> 2) A binding within an instance declaration cannot be a
> pattern binding. Elsewhere, the ambiguity is resolved
> as an n+k binding.
This seems rather ad-hoc. Why are instance declarations special?
class Integral a => Foo a where
v :: a
instance Foo Int where
(v+1) = ...
Let's either disallow (n+k) pattern bindings or always resolve the
ambiguity as an (n+k) pattern. I'd prefer the former, but I never
use (n+k) patterns, anyway.
Kevin