haskell / haskell/vector

basicOverlaps is pretty weak

Open
#88 1 comment 0 reactions 0 assignees View on GitHub
bug design-shed enhancement
Dominant language
Haskell
Stars
400
Forks
145
PR merge metrics
No merged PRs in 30d

Description

The current `basicOverlaps` check doesn't actually fully determine if each of the constituent sub-arrays overlap.

e.g.

``` haskell
basicOverlaps (MV_3 n_1 as1 bs1 cs1) (MV_3 n_2 as2 bs2 cs2)
= M.basicOverlaps as1 as2
|| M.basicOverlaps bs1 bs2
|| M.basicOverlaps cs1 cs2
```

only checks the overlap between corresponding elements, but if you used something like

``` haskell
roll (MV_3 n as bs cs) = MV_3 n bs cs as
```

then something like `overlaps mv (roll mv)` will report `False` even though it has arrays that 'overlap' the originals rendering destructive changes hazardous.

I'm not really sure that this is such a damning failing, none of the existing combinators will produce such a rotation, but I figured it was worth capturing in an issue rather than passively ignoring the concern.

An example of where it might matter would be if you let zip for unboxed vectors try to get clever about reusing the source vectors.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.