massiv
massiv copied to clipboard
Ease of Use Improvements
I think massiv
is a great library and delivers great performance. However, I believe it is also very hard to use due to the complicated types. Here are some rather radical ideas which might improve the situation.
- Assume
Seq
everywhere which is usually the right choice. If parallel computation is desired,Par
should be specified when computing. - Remove function names with
'
at the end. I think the partial functions should be the default ones; indexing/dimension errors are usually programming errors. - Be less polymorphic. Make
makeArray
and other generation functions return delayed arrays to aid type inference and make it less confusing. - Support
OverloadedRecordDot
forIxN
andSzN
to get the individual coordinates - The doc page for
Data.Massiv.Array
is very long and it is often hard to find the right functions. Maybe put theM
variants in a different place and have a separate docs for them (e.g.Data.Massiv.Array.Safe
). - Combine the safe and partial functions into one by combining
Dimension n
andDim
, i.e. provide a constructor forDimension
that is not checked. - Replace
index
,read
with a partial function. I would imagine that many people use them in combination withfromJust
. - There are potentially too many different representations. However, I am not too sure what to do here.
Please feel free to tell me what you think about these changes. Not all of them might be good but I included them to be thought-provoking.
These changes are obviously breaking changes and would need a major version update. Maybe others also have some ideas if backwards compatibility restrictions could be ignored.