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

Ertugrul Söylemez es at ertes.de
Fri Jul 6 11:52:44 CEST 2012

Tsuyoshi Ito <tsuyoshi.ito.2006 at gmail.com> wrote:

> How can I use combinators like repeat, which takes a plain function as
> an argument, in the arrow notation in a more readable way?  Or am I
> trying to do an impossible thing?

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

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

    test2 :: MyArr [Double] String
    test2 = repeat 100 rmap . liftA3 (,,) id y z
        y = arr func1
        z = job1
        rmap i = lmap (\(xs, y, z) -> xs !! i + y + z) (job3 (i * 2))

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

[1]: http://hackage.haskell.org/package/profunctors


Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120706/ed6c1ea6/attachment.pgp>

More information about the Haskell-Cafe mailing list