These rules seem ... weird. Why, for example, do we need a special mapFB/mapFB rule? Shouldn't map f . map g translate to a build/foldr/build/foldr, fuse to build/foldr, and then translate back to map? Is this a case of something that almost works but not quite, and that needs patching up for a lot of cases?

On Jul 22, 2014 6:53 PM, "wren romano" <winterkoninkje@gmail.com> wrote:
On Tue, Jul 22, 2014 at 6:42 PM, David Feuer <david.feuer@gmail.com> wrote:
> I'm looking for some help writing some translate/untranslate rules to
> implement fusion for a couple of basic functions (the ones I'm looking at
> right now are takeWhile and scanr, but there may be others). I have a
> translation for takeWhile that seems to be at least decent, and one for
> scanr that is completely untested. I've never mucked about with GHC RULES,
> however, so I don't even know where to begin.

Probably the best place to start is to take a look at the source for
GHC.Base and GHC.List, in particular the rules for map and filter
capture the overarching pattern of how to stage the different rules.

<http://hackage.haskell.org/package/base-4.7.0.1/docs/src/GHC-Base.html#map>
<http://hackage.haskell.org/package/base-4.7.0.1/docs/src/GHC-List.html#filter>

--
Live well,
~wren
_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://www.haskell.org/mailman/listinfo/libraries