lehins / massiv

Efficient Haskell Arrays featuring Parallel computation
BSD 3-Clause "New" or "Revised" License
384 stars 23 forks source link

`findIndex` should not be in `Data.Massiv.Vector` #123

Open dschrempf opened 1 year ago

dschrempf commented 1 year ago

Hi! Thank you for this great package!

I just wrote my own findIndex function for general arrays before finding a similar function in Data.Massiv.Vector. I think the function findIndex should be moved to a more general module!

Thank you!

EDIT: Or, maybe. move the function and add a specialized one to Data.Massiv.Vector?

lehins commented 1 year ago

The function itself is defined and exported from: Data.Massiv.Array.Manifest.findIndex https://github.com/lehins/massiv/blob/01ac573a5a5d7e9484e53cb1fc9c957e579a02b8/massiv/src/Data/Massiv/Array/Manifest.hs#L217-L222

It is merely re-exported from Data.Massiv.Vector and Data.Massiv.Array modules. I am not sure there is benefit of removing re-export and redefining a specialized version in Data.Massiv.Vector

I think a better solution would be instead of re-exporting the full Data.Massiv.Array.Manifest re-export functions from the module in Data.Massiv.Array in organized manner.

There is quite a bit documentation improvement massiv could use. PRs are always welcome.

dschrempf commented 1 year ago

I see, thank you for the explanation.

I just didn't find this or any similar function in the documentation of Data.Massiv.Array. Yes, an organized re-export would be the preferred solution...