Closed zyla closed 4 years ago
Totally incorrect. The situation for traverse
is just as bad. If I swap out the Foldable
instance with one defined foldMap = foldMapDefault
, I get a totally different (still totally wrong) result: [33,32,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]
.
Oh dear... chewing away with null
, drop 1
, and unsafeIndex
goofs this up too. The whole slicing machine seems to be broken.
@travitch, if you can document the datatypes a bit better, I can take a shot at fixing this. Such broken behavior really blocks up my ideas for improving performance.
It may be better to just tear out the slicing code and deal with the bad performance of those operations until the core is in a more usable state. I can try to remember what the slicing was attempting to do - presumably there is just some index confusion, but the traversal is so entangled with that code that it is difficult to tease them apart.
Okay. I'll give that a shot. Best to start with something correct and try fixing performance afterwards.
@travitch, I'll strip that, and then I'll remove the Empty
constructor. That'll give us vectors as records, so we can reasonably build sliced vectors on top and get everything to unpack nicely. If we're careful, we can probably keep code duplication to a minimum.
Thanks for taking a look at this! I've been wanting to get back to this structure for a while. The performance profile is a bit weird but I have high hopes for it in some cases.
Hello. I discovered some cases where the library returns results I believe are incorrect:
In this example we request a slice of length 1, but get back a result of length 2.
Here the result should be
[1]
.The first
drop
(first in evaluation order; the one with argument15
) seems to be completely ignored here. The number 15 can be changed to any number between 1 and 31 and gives the same result.These test cases are minimized from larger ones which I generated using QuickCheck.