On Fri, Apr 24, 2009 at 19:49, Edward Kmett ekm...@gmail.com wrote:
On Fri, Apr 24, 2009 at 5:11 PM, Denis Bueno dbu...@gmail.com wrote:
Is there an Ord instance that can be dynamically changed in this way?
My first idea is something like this:
data CompareRecord = CR{ rCompare :: Record
Hi all,
Suppose I have the following interface to a sorting function:
sort :: (Ord a) = [a] - IO [a] -- sort large, on-disk array of records
but I don't have a sortBy where you can simply pass a compare function.
Wrapped around this is a command-line program which should allow the
user to
On Fri, Apr 24, 2009 at 15:22, Martijn van Steenbergen
mart...@van.steenbergen.nl wrote:
Hi Denis,
Denis Bueno wrote:
where the rCompare field would be a function that is based on the
flags passed to the command-line problem. But this has an ugly
asymmetry. Does anyone have any other
Hi Denis,
Denis Bueno wrote:
where the rCompare field would be a function that is based on the
flags passed to the command-line problem. But this has an ugly
asymmetry. Does anyone have any other ideas?
Here's a solution that is more symmetrical but not necessarily prettier:
newtype Wrap =
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 =
Denis Bueno wrote:
Hi all,
Suppose I have the following interface to a sorting function:
sort :: (Ord a) = [a] - IO [a] -- sort large, on-disk array of records
but I don't have a sortBy where you can simply pass a compare function.
Why don't you have sortBy?
Wrapped around this is a
On Fri, Apr 24, 2009 at 5:11 PM, Denis Bueno dbu...@gmail.com wrote:
Hi all,
Suppose I have the following interface to a sorting function:
sort :: (Ord a) = [a] - IO [a] -- sort large, on-disk array of records
but I don't have a sortBy where you can simply pass a compare function.