massiv icon indicating copy to clipboard operation
massiv copied to clipboard

Ease of Use Improvements

Open Simre1 opened this issue 1 year ago • 0 comments

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.

  1. Assume Seq everywhere which is usually the right choice. If parallel computation is desired, Par should be specified when computing.
  2. Remove function names with ' at the end. I think the partial functions should be the default ones; indexing/dimension errors are usually programming errors.
  3. Be less polymorphic. Make makeArray and other generation functions return delayed arrays to aid type inference and make it less confusing.
  4. Support OverloadedRecordDot for IxN and SzN to get the individual coordinates
  5. The doc page for Data.Massiv.Array is very long and it is often hard to find the right functions. Maybe put the M variants in a different place and have a separate docs for them (e.g. Data.Massiv.Array.Safe).
  6. Combine the safe and partial functions into one by combining Dimension n and Dim, i.e. provide a constructor for Dimension that is not checked.
  7. Replace index, read with a partial function. I would imagine that many people use them in combination with fromJust.
  8. 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.

Simre1 avatar Dec 24 '23 11:12 Simre1