elm-community/basics-extra/1.2.0

NOTE: this package is not compatible with Elm 0.19.1

Basics.Extra

Additional basic functions.

Never

never : Never -> a

The empty function. This converts a value of type Never into a value of any type, which is safe because there are no values of type Never. Useful in certain situations as argument to Task.perform and Html.App.map.

Note: To use this function, its argument need not be literally of type Never. It suffices if it is a fully polymorphic value. For example, this works: Process.sleep >> Task.perform never (\() -> ...), because the output of Process.sleep is fully polymorphic in the x of Task x ().

Tuples

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

A shorthand for writing 2-tuples. Very commonly used when expressing key/value pairs in CSS or Json encoders.

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

Swaps the elements in a tuple.

swap ( 1, 2 ) == ( 2, 1 )