Skip to content

Instantly share code, notes, and snippets.

@wknapik
Created May 13, 2018 17:32
Show Gist options
  • Save wknapik/e88bac3644eed3ce4a2f7668f449aac5 to your computer and use it in GitHub Desktop.
Save wknapik/e88bac3644eed3ce4a2f7668f449aac5 to your computer and use it in GitHub Desktop.
List.sortBy produces different order between Chromium/Chrome and Firefox
module Main exposing (..)
import Html exposing (div, text)
import List
import Tuple
main =
Html.beginnerProgram { model = [], view = view, update = (\_ -> \x -> x) }
view _ =
div [] <| List.map (div [] << List.singleton << text << Tuple.first) (List.sortBy Tuple.second tuples)
tuples =
[ ( "1", "foo" )
, ( "2", "bar" )
, ( "3", "foo" )
, ( "4", "foo" )
, ( "5", "foo" )
, ( "6", "baz" )
, ( "7", "foo" )
, ( "8", "quux" )
, ( "9", "foo" )
, ( "10", "foo" )
, ( "11", "foo" )
]
@wknapik
Copy link
Author

wknapik commented May 13, 2018

Chromium/Chrome 66.0.3359.139:

2
6
3
4
5
1
7
10
9
11
8

Firefox 59.0.2:

2
6
1
3
4
5
7
9
10
11
8

Tested on Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment