[Haskell-cafe] vector recycling

Roman Leshchinskiy rl at cse.unsw.edu.au
Sun Apr 18 21:33:02 EDT 2010

On 18/04/2010, at 08:07, Ben wrote:

> On Fri, Apr 16, 2010 at 11:19 PM, Roman Leshchinskiy <rl at cse.unsw.edu.au> wrote:
>> That said, it would be quite possible to provide something like the following:
>> fold_inplace :: Vector v a => (v a -> b -> v a) -> v a -> [b] -> v a
> as far as i understand there would be two ways of writing such a
> function : 1) to use mutable vectors monadically underneath and hide
> them inside some kind of unsafeX, or 2) to give a specialized fold
> with sufficient hints to the compiler to use the rewriting framework.

Right, I meant 2. I'm not saying it's necessarily a good idea, just that it would be possible.

>> This could use the recycling framework to safely do as much in-place as possible while still preserving a purely functional interface. I have to think about it. Really, this looks like just a poor man's substitute for linear types.
> although i am supposed to know something about category theory, since
> my training is in math, i don't know about girard's later work.  is
> there a short precis you can give (or a pointer?)

This is a nice introduction:


Also, Clean's uniqueness types are quite similar.


More information about the Haskell-Cafe mailing list