David Feuer
David Feuer
(Or maybe you can avoid the zip with an accumulator? I dunno.)
How do things go when fusion doesn't happen?
Is there any way to get side by side comparisons of times and allocations? All the befores followed by all the afters is hard to look at.
Don't scare me like that! I thought you meant the property tests failed. How confident are you that you don't have something corrupted on your end? Can you reproduce the...
A couple examples: 1. Comparing two mutable arrays for (pointer) equality should not consume them. 2. Comparing the addresses of two pinned mutable byte arrays (with `compare`) should not consume...
> I think `initMaybe` and `lastMaybe` would be good to have. A good implementation that works with fusion may require some thought. `lastMaybe` supports two different implementations, a lazy one...
@meooow25, I don't think `initMaybe` can be a good consumer, while maintaining the laziness that's surely expected of it. The problem is going to be similar to the lazy version...
> [@meooow25](https://github.com/meooow25), putting aside Haddock documentation for the moment, does this 'work' from that perspective? Your `maybeInit` looks about right, but you'll have to grovel over Core to verify that...
> One thing to note that `Data.List.init` is neither a good producer nor a good consumer ([source](https://hackage.haskell.org/package/ghc-internal-9.1201.0/docs/src/GHC.Internal.List.html#init)). So maybe `initMaybe` doesn't have to fuse either, though it would be nice...
I suspect what I'm really looking for here is an affine stream type, rather than a queue. That said, consider [Breadth-First Numbering: Lessons from a Small Exercise in Algorithm Design](https://dl.acm.org/doi/pdf/10.1145/351240.351253)...