<div dir="ltr">  Dear Haskellers,<div><br></div><div style>I&#39;m working on a sorting library for MArrays. Speed is important, so I want to optimize it as much as possible.</div><div style><br></div><div style>Currently, I simply INLINE the sorting function. This speeds up the code more than 10 times. However this can easily explode code size if the function is used in several places.</div>

<div style><br></div><div style>The only other alternative seems to SPECIALIZE the function for all instances of MArray. This also enlarges the resulting code, but only by a constant factor, not depending on how many times the function is used. The question is, is it possible that new instanes of MArray appear? Or is MArray so special and bound to GHC&#39;s internals so that I can be sure that no new instances can be defined by some other module?</div>

<div style><br></div><div style>  Thanks for help,</div><div style>  Petr Pudlak</div></div>