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

2012-07-15 Thread Tsuyoshi Ito
On Fri, Jul 13, 2012 at 8:11 AM, Ross Paterson r...@soi.city.ac.uk wrote: On Thu, Jul 12, 2012 at 02:47:57PM +0100, Ross Paterson wrote: Though one possibility that might get us most of the way there would be to refactor the Arrow class as class PreArrow a where premap :: (b - b') - a

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

2012-07-15 Thread Ertugrul Söylemez
Ross Paterson r...@soi.city.ac.uk wrote: Though one possibility that might get us most of the way there would be to refactor the Arrow class as class PreArrow a where premap :: (b - b') - a b' c - a b c Note that you are reinventing the 'profunctors' package here. Every arrow forms a

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

2012-07-15 Thread Ross Paterson
On Sun, Jul 15, 2012 at 06:51:07PM +0100, Tsuyoshi Ito wrote: Thank you for the response. This sounds exciting, but sadly, I must admit that it is a little (?) above my head, and I cannot relate this extension to my original question…. Sorry about that -- I got a bit side-tracked. The

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

2012-07-15 Thread Ross Paterson
Silly me -- that code works with the current GHC (module attached). I still think the generalization is worth doing, though. - {-# LANGUAGE Arrows #-} module ArrowTest where import Control.Applicative import Control.Arrow

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

2012-07-15 Thread Tsuyoshi Ito
On Sun, Jul 15, 2012 at 6:30 PM, Ross Paterson r...@soi.city.ac.uk wrote: Silly me -- that code works with the current GHC (module attached). Aha! Now I see why the GHC documentation states “the arrows involved need not be the same” in the section about banana brackets. After all, I was wrong

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

2012-07-13 Thread Ross Paterson
On Thu, Jul 12, 2012 at 02:47:57PM +0100, Ross Paterson wrote: Though one possibility that might get us most of the way there would be to refactor the Arrow class as class PreArrow a where premap :: (b - b') - a b' c - a b c class (Category a, PreArrow a) = Arrow a where arr

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

2012-07-12 Thread Ross Paterson
On Thu, Jul 05, 2012 at 10:55:07PM +0100, Tsuyoshi Ito wrote: In a program, I have an arrow MyArr and a combinator called repeat of the following type: repeat :: Int - (Int - MyArr e a) - MyArr e a My problem is that the code becomes messy when I use this combinator inside the arrow

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

2012-07-06 Thread Ertugrul Söylemez
Tsuyoshi Ito tsuyoshi.ito.2...@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

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

2012-07-06 Thread Tsuyoshi Ito
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

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

2012-07-05 Thread Tsuyoshi Ito
Hello, In a program, I have an arrow MyArr and a combinator called repeat of the following type: repeat :: Int - (Int - MyArr e a) - MyArr e a My problem is that the code becomes messy when I use this combinator inside the arrow notation, and I am looking for a way to write the code in a