
On 18/04/2010, at 08:07, Ben wrote:
On Fri, Apr 16, 2010 at 11:19 PM, Roman Leshchinskiy
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: http://homepages.inf.ed.ac.uk/wadler/papers/linear/linear.ps Also, Clean's uniqueness types are quite similar. Roman