[Haskell-cafe] Plain lambda inside banana brackets in the arrow notation

Tsuyoshi Ito tsuyoshi.ito.2006 at gmail.com
Fri Jul 6 16:42:56 CEST 2012


Dear Ertugrul,

Thank you for your input.

> To answer your question:  Arrow notation has no support for what you
> want, so if you stick with it you will have to write the inner proc
> explicitly.

Oh.  I was afraid of that.

> However:  The code may look much nicer, if you use applicative style for
> the outer computation using Applicative, Category and Profunctor [1]:

Thank you for the code.  It looks much nicer than my code, which uses
the arrow notation both for inner and outer computations.

> If you prefer, you can use arrow notation for the inner computation.

This was a blind spot for me; I had not thought of mixing the arrow
notation and the plain notation.  This definitely helps writing a code
when either the outer computation or the inner computation is simple.

Unfortunately, sometimes both the outer computation and the inner
computation involve many local variables, in which case I need the
arrow notation for both, forcing me to write the inner proc explicitly
inside the outer proc.  If someone extends the arrow notation someday
and makes this use case easier, that will be great.  For now, avoiding
the arrow notation for simple computations and writing two proc’s when
both computations are complicated seems like a reasonable compromise
to me.  Thanks a lot!

Best regards,
  Tsuyoshi



More information about the Haskell-Cafe mailing list