darcs patch: Data.List.sort: force elements from start to end.

Hi,
the patch below is a trivial change to the merge helper function
of Data.List.sort. Its effect is that the first argument of merge
is evaluated before the second argument instead of vice versa.
I think it's obviously correct. Also, sort is necessarily strict in
the whole list, so there can be no loss of laziness.
Rationale:
The change helps to avoid a stack overflow in the common case where
each element of a list depends on the previous one. Examples for such
lists are '[1..]' or uses of 'iterate f' where f is a strict function.
I believe this case is far more common than the opposite case where
each element of the list depends on the next one, so the patch below is
an improvement.
See also
http://thread.gmane.org/gmane.comp.lang.haskell.cafe/30598
Bertram
Wed Nov 21 11:14:58 CET 2007 Bertram Felgenhauer

On Wed, Nov 21, 2007 at 11:29:51AM +0100, Bertram Felgenhauer wrote:
Wed Nov 21 11:14:58 CET 2007 Bertram Felgenhauer
* Data.List.sort: force elements from start to end. this prevents a stack overflow on sort (take 10^6 [1..])
Applied, thanks! Sorry for the delay. Thanks Ian
participants (2)
-
Bertram Felgenhauer
-
Ian Lynagh