Fresheyeball/elm-tuple-extra/2.2.0

NOTE: this package is not compatible with Elm 0.19.1

Tuple2

Tuple definition

(=>) : a -> b -> ( a, b )

Define a double with infix operator. Primarily used, when defining a List with key-value Tuples.

Dict.fromList
    [ 0 => 'a'
    , 1 => 'b'
    , 2 => 'c'
    ]

Map

map : (b -> x) -> ( a, b ) -> ( a, x )
mapFst : (a -> x) -> ( a, b ) -> ( x, b )
mapSnd : (b -> x) -> ( a, b ) -> ( a, x )
mapEach : (a -> x) -> (b -> x_) -> ( a, b ) -> ( x, x_ )
mapBoth : (a -> b) -> ( a, a ) -> ( b, b )

Swap

swap : ( a, b ) -> ( b, a )

Sorting

sort : ( comparable, comparable ) -> ( comparable, comparable )
sortBy : (a -> comparable) -> ( a, a ) -> ( a, a )
sortWith : (a -> a -> Order) -> ( a, a ) -> ( a, a )

Transform

toList : ( a, a ) -> List a