Arrow notation, etc.

Ross Paterson ross@soi.city.ac.uk
Fri, 12 Oct 2001 14:01:28 +0100


On Fri, Oct 12, 2001 at 08:33:15PM +0900, Dylan Thurston wrote:
> So when I read the "Syntactic Sugar for Arrows" proposal, my initial
> reaction is "Wow, that's a little complicated.  It doesn't look like
> syntactic sugar to me."

Why, thank you!

> This contrasts with the do-notation, which does look like syntactic
> sugar: you can rewrite any do expression in terms of the basic
> combinators with a bounded amount of pain.[1]  Somehow with Arrows
> the point-free syntax you are forced into is extraordinarily unwieldy,
> and the arrows "syntactic sugar" is much handier.

I guess it's the generality of the arrows interface that makes it so
awkward to use.  There are some examples of this awkwardness in sections
7 and (especially) 9 of the draft version of John Hughes's arrows paper
(http://www.cs.chalmers.se/~rjmh/arrows.ps or .pdf).

> Incidentally, it seems to me that this is one case where a Lisp-like
> macro facility might be useful.  With Haskell, it is impossible to
> play with bindings, while presumably you can do this with good Lisp
> macro systems.

If you extend the syntax using macros, it's essential for pain-limitation
that errors are presented in terms of derived type rules for the macros.
There's a paper on type-safe macros (not Haskell, but could be) in
ICFP 2001 by Ganz, Sabry and Taha.  The arrows stuff seems like it would
require a second-order variant though (macros with macro arguments).