logo       

[ ghc-Bugs-643878 ] sortBy not stable: msg#00046

lang.haskell.glasgow.bugs

Subject: [ ghc-Bugs-643878 ] sortBy not stable

Bugs item #643878, was opened at 2002-11-25 17:12
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=643878&group_id=8032

Category: Prelude
Group: 5.04.1
>Status: Closed
Resolution: Fixed
Priority: 7
Submitted By: Mike Gunter (magunter)
Assigned to: Nobody/Anonymous (nobody)
Summary: sortBy not stable

Initial Comment:
The library report requires that sortBy be stable. In
5.04.1 it isn't:

gunter.philco.com[1995]$ ghci
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version
5.04, for Haskell 98.
/ /_\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.

Loading package base ... linking ... done.
Loading package haskell98 ... linking ... done.
Prelude> List.sortBy (\ (_,a) (_,b) -> compare a b) $
zip [0..] [100,0,0,0]
[(3,0),(2,0),(1,0),(0,100)]

. In 5.02.3, it was stable:

c966553-A[2314]$ ghci
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version
5.02.3, for Haskell 98.
/ /_\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.

Loading package std ... linking ... done.
Prelude> List.sortBy (\ (_,a) (_,b) -> compare a b) $
zip [0..] [100,0,0,0]
[(1,0),(2,0),(3,0),(0,100)]


----------------------------------------------------------------------

>Comment By: Sigbjorn Finne (sigbjorn)
Date: 2002-11-26 11:26

Message:
Logged In: YES
user_id=232905

ghc-5.04.1 does include a stable sort. The bug reporter
incorrectly refers to ghc-5.04 as ghc-5.04.1

----------------------------------------------------------------------

Comment By: Simon Marlow (simonmar)
Date: 2002-11-26 01:52

Message:
Logged In: YES
user_id=48280

This one has been fixed, grab 5.04.2 when it is released.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=643878&group_id=8032


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise