I'm working on a sorting library for MArrays. Speed is important, so I want to optimize it as much as possible.
Currently, I simply INLINE the sorting functions. This speeds up the code more than 10 times, compared to the non-optimized code. However this can easily explode code size if the functions are used in several places, and slows down compilation.
The only other alternative seems to SPECIALIZE the functions for all existing instances of MArray. This also enlarges the resulting code, but only by a constant factor, which doesn't depend on how many times the functions are used. The question is, is it possible that new instances of MArray appear? Or is MArray so special and bound to Haskell's internals so that I can be sure that no new instances can be defined by some other module?
MArray
instances they declare. – Ahmedahmedabad