
On Thursday 20 May 2004 11:45 am, Simon Marlow wrote:
In the case of writing/pushing, the COrdering allows you to pass a composition of a comparison and a combining function around, which looks cleaner. It's not obviously more efficient than passing the two functions around, because the actual comparisons will be going through an extra level of higher-order function
Only if those combinators are used, but they're not the only way of creating combining comparisons. In fact I think it more likely that folk would write their own rather than use ordinary comparisons+combinators, except perhaps in the case of simple comparisons (typically those cases where deriving Ord is likely to give a sane ordering and comparison algorithm).
(except that you've INLINEd everything in sight, so the COrdering combinators probably disappear
:-).
Have not :-) Those combinators are inlined because of their triviality and the potential efficiency implications if not inlined. But if you look at the rest of the code I think you'll find inlining has only been used for similar reasons on trivial code or on more complex functions which are used only once because they really part of an enormous pattern matching exercise which has been broken into bits to make it more manageable. Regards -- Adrian Hey