[Haskell] How to zip folds: A library of fold transformers

2005-10-11 Thread oleg
We show how to merge two folds into another fold `elementwise'. Furthermore, we present a library of (potentially infinite) ``lists'' represented as folds (aka streams, aka success-failure-continuation--based generators). Whereas the standard Prelude functions such as |map| and |take| transform li

Re: [Haskell] How to zip folds: A library of fold transformers

2005-10-13 Thread oleg
Dylan Thurston wrote: > > The defining equations are: if flst is a value > > of a type |FR a|, then > > unFR flst f z = z if flst represents an empty list > > unFR flst f z = f e (unFR flst' f z) > > if flst represents the list with the head 'e' > >

Re: [Haskell] How to zip folds: A library of fold transformers

2005-10-14 Thread Dylan Thurston
On Tue, Oct 11, 2005 at 05:25:24PM -0700, [EMAIL PROTECTED] wrote: > First we define the representation of a list as a fold: > > > newtype FR a = FR (forall ans. (a -> ans -> ans) -> ans -> ans) > > unFR (FR x) = x > > It has a rank-2 type. The defining equations are: if flst is a value > of a typ

RE: [Haskell] How to zip folds: A library of fold transformers

2005-10-28 Thread Simon Peyton-Jones
unctions.html. Also Josef Svengingsson (ICFP'02). I don't know how these relate to your solution. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of | [EMAIL PROTECTED] | Sent: 12 October 2005 01:25 | To: haskell@haskell.org | Subject: [Haskel

RE: [Haskell] How to zip folds: A library of fold transformers

2005-10-29 Thread oleg
Hello! > I'm sure you're aware of the close connection between your FR > stuff (nice) and the foldr/build list-fusion work? I am now. Indeed, the 'FR' representation of lists is what one passes to 'build'. Incidentally, the higher-rank type of FR is a _requirement_ (otherwise, things won't type