Oops, sent prematurely.
`mapStencil2` seems to be allocating one extra machine word per stencil computation. So not entirely unboxed, but much better.
Latest code is at
Can anyone explain to me how the Identity monad manages to guarantee the sequencing/non-nesting requirements of computeP? As far as I can tell, it should be reduced to plain old function application, which is the same as nesting computeP, which is what we were trying to prevent.
In other words, what effect does the Identity monad have over not having a monad at all? Its bind definition has no sequencing effects or anything, so I can't imagine that it actually accomplishes anything.
Cheers,
Will