Arrow Development

Ross Paterson R.Paterson at city.ac.uk
Sat Feb 21 10:39:03 UTC 2015


On Fri, Feb 20, 2015 at 02:58:14AM -0500, Thomas Bereknyei wrote:
> I am looking at the proc notation de-sugar and I see results like this when
> using a Free Arrow (mostly copied from [1]):
> line2 = proc n -> do
>   Effect getURLSum *** Effect getURLSum -< n
> 
> Seq [Pure ] (Seq [Pure ] (Seq [Pure ] (Seq [Pure ](Par <Effect > {Effect } ) ) ) )
> 
> while this is so much simpler:
> line2 = Effect getURLSum *** Effect getURLSum 
> 
> Par <Effect > {Effect }
> 
> Those `Seq [Pure ]` sequences come from application of (.) and I have noticed
> many similar inefficiencies in the Arrow preprocessor. Eventually the goal
> would be to optimize when possible, for example I started looking into this in
> order to use `concurrently` for (***) when in IO.
> 
> There was a rewrite mentioned here [2]. The deSugar/DsArrows.hs [3] looks
> convoluted. Any progress or work needed? Or are Arrows not used much and not
> worth the effort?

I don't think it's feasible to try to do optimization in the desugarer,
which certainly is convoluted.  You might have more luck using RULES to
simplify the output.

(The desugarer could be simplified -- a lot of what it does probably belongs
in the renamer -- but I'm not sure that would help with optimization.)


More information about the ghc-devs mailing list