fix for Data.List.sortBy

Siddhanathan Shanmugam siddhanathan+eml at gmail.com
Tue Mar 28 19:34:26 UTC 2017


On Tue, Mar 28, 2017 at 11:57 AM, David Feuer <david.feuer at gmail.com> wrote:

> You probably should bind the value you're forcing,
>

I'm guessing a bang pattern should do the trick:

    ascending a as (b:bs)
      | a `cmp` b /= GT = ascending b (\ys -> as (a:ys)) bs
    ascending a as bs   = let !v = as [a] in v : sequences bs

    mergePairs (a:b:xs) = let !v = merge a b in v : mergePairs xs
    mergePairs xs       = xs

    {-# INLINE merge #-}
    merge as@(a:as') bs@(b:bs')



> even if the difference is small.
>

Out of curiosity, why would there be a difference at all?




>
> On Mar 28, 2017 2:51 PM, "Siddhanathan Shanmugam" <
> siddhanathan+eml at gmail.com> wrote:
>
>>     mergePairs (a:b:xs) = merge a b `seq` merge a b : mergePairs xs
>>
>> as well.
>>
>> On Tue, Mar 28, 2017 at 11:43 AM, Gregory Popovitch <greg7mdp at gmail.com>
>> wrote:
>>
>>> OK, so current proposed changes are below:
>>>
>>>
>>> test results look good.
>>>
>>> Thanks,
>>>
>>> greg
>>>
>>>
>>>
>>
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20170328/799fb105/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook.jpg
Type: image/jpeg
Size: 106027 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20170328/799fb105/attachment-0001.jpg>


More information about the Libraries mailing list