[Haskell-cafe] computation over containers, greatly simplified notation.
muranushi at gmail.com
Wed Nov 28 18:57:03 CET 2012
I came up with an idea to greatly simplify some kinds of array
computations. It should work well with many kinds of arrays. Is this new?
These few days, I've been trying to rewrite a hydrodynamic simulation code
that used Data.Vector (~250 lines), to Repa  . It seemed promising, but
soon I realized that I needed to use Repa.map and Repa.zipWith almost
everywhere. I need careful thinking to transform every lines (that used
vector's indexing) to Repa's point-free stile. Is there any better ways?
Then I realized that I was the author of Paraiso , a DSL for stencil
computation. One of its feature is to write down array computation just as
if it were scalar computation.
Basically what I need is ZipList-like Applicative instances for vectors and
Repa arrays. Why not they support ZipVector? Because 'pure' of zipList was
an infinite list and you can't do infinite vectors. Then I came up with
the wrapper W does several things: it represents the 'pure,' homogeneous
array in a space-efficient manner, and also serves as a newtype-wrapper of
Num (and possibly Fractional, Floating...) instances.
Questions are: is this technology new? or promising? doomed?
It seems to me like a free-Applicative, like the free-Monad theory. Are
The function 'backend' helps to mix in the non-zip-like computations. How
can we remove the 'undefined' in the 'backend?'
Some of Repa computations are Monads. W needs to be a monad transformer to
Also I'm grateful to past cafe discussion on existing Zippable
implementations  .
The Hakubi Center for Advanced Research, Kyoto University
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe