[Haskell-cafe] Plain lambda inside banana brackets in the arrow notation
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 :
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.
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...
Size: 836 bytes
Desc: not available
More information about the Haskell-Cafe