logo       

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

lang.haskell.glasgow.bugs

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

Bugs item #643878, was opened at 2002-11-26 01: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: Open
Resolution: None
Priority: 5
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)]


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

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