BTW, I notice that your merges, like mine, are left-biased. This is a
useful property (my callers require it), and doesn't seem to cost
anything to implement, so maybe you could commit to it in the
documentation?
By left-biased I mean that when elements compare equal, pick the
leftmost one, e.g. "mergeOn fst [(0, 'a')] [(0, 'b')] == [(0, 'a'),
(0, 'b')]".
And BTW again, here's something I've occasionally found useful:
-- | Handy to merge or sort a descending list.
reverse_compare :: (Ord a) => a -> a -> Ordering
reverse_compare a b = case compare a b of
LT -> GT
EQ -> EQ
GT -> LT
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe