
24 Apr
2009
24 Apr
'09
9:27 p.m.
Denis Bueno wrote:
The problem here is that the order is fixed. Statically. I can't change it at runtime based on flags. (Right? Unless I'm missing something....)
That is right. It might or might not be a problem in your specific case.
sortBy :: (a -> a -> Ord) -> [a] -> IO [a] sortBy cmp = map unCR . sort . map (CompareRecord cmp)
Right, that's what I was thinking, too. The asymmetry was giving me the willies, though. =]
Yeah, I know what you mean; it doesn't feel very elegant. :-) I'm curious if anyone else has any neat ideas. Martijn.