Skip to content
Snippets Groups Projects
Commit a7f0953a authored by Iustin Pop's avatar Iustin Pop
Browse files

Make niceSort a wrapper over niceSortKey id


Currently, niceSort behaves differently than niceSortKey in cases
where the parsed groups are equal but the original not, as it uses
both members of the tuple as opposed to just the first one. Both
niceSortKey and the Python code use only the first one, so in corner
cases we can have different behaviour of these functions.

To rectify this, we change niceSort to be a simple wrapper over
"niceSortKey id", so that we get consistent behaviour.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 96b28307
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
{-
Copyright (C) 2009, 2010, 2011, 2012 Google Inc.
Copyright (C) 2009, 2010, 2011, 2012, 2013 Google Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -267,7 +267,7 @@ we only need one extra step of dropping the key at the end.
-}
niceSort :: [String] -> [String]
niceSort = map snd . sort . map (\s -> (fst $ extractKey [] s, s))
niceSort = niceSortKey id
-- | Key-version of 'niceSort'. We use 'sortBy' and @compare `on` fst@
-- since we don't want to add an ordering constraint on the /a/ type,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment