G'day all. Quoting "S. Alexander Jacobson" <[EMAIL PROTECTED]>:
> I'll cite that hoary Hoare quotation here. > "Premature optimization is the root of all evil." Agreed! In particular, functions meant for general use, especially in the standard library, should not optimise for a specific case and pessimise for all other cases. Much evil has budded from library implementors who thought they knew better than application programmers about what performance models were appropriate. (If you don't believe me, ask a C++ developer about reference-counted strings and multi- threading some time.) Making sizeFM return Integer optimises the operation for cases where the FiniteMaps are extremely huge and pessimises it for all cases where the FiniteMaps are not extremely huge. Not only is this premature optimisation, it's optimising for the empirically LEAST likely case. Now that I think of it, it would make far more sense for the type to be completely general: sizeFM :: (Ord key, Integral size) => FiniteMap key elt -> size This way, sizeFM can optimise itself for the situation at hand. Cheers, Andrew Bromage _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell