Christian wrote:
> Frank A. Christoph gave examples for unintended non-linear patterns,
> among them:
>
> > Or, even more more common:
> >
> >   f (x@(x,y)) = ... --- oops!
>
> If I don't oversee something obvious, this just would fail to
> type-check, so this shouldn't be a problem.

As you can plainly see, in anticipation of such a clever remark I had
already annotated the clause with a comment indicating my reaction. :)

Yeah, that's the ticket...

OK, here's a less likely variant:

  f (y@(x:y)) = ...  --- oops! (just in case :)

whose translation

  f (z@(u:v)) | z == v = ...

is well-typed.

--FC



Reply via email to