`(==) : a -> a -> Bool`

Note: Elm uses structural equality on tuples, records, and user-defined union types. This means the values (3, 4) and (3, 4) are definitely equal. This is not true in languages like JavaScript that use reference equality on objects.

Note: Equality (in the Elm sense) is not possible for certain types. For example, the functions (\n -> n + 1) and (\n -> 1 + n) are “the same” but detecting this in general is undecidable. Problematic types include functions and JavaScript values like Json.Encode.Value which could contain functions if passed through a port.

`(/=) : a -> a -> Bool`

Comparison These functions only work on comparable types. This includes numbers, characters, strings, lists of comparable things, and tuples of comparable things. Note that tuples with 7 or more elements are not comparable; why are your tuples so big?

`(<) : comparable -> comparable -> Bool`

`(>) : comparable -> comparable -> Bool`

`(<=) : comparable -> comparable -> Bool`

`(>=) : comparable -> comparable -> Bool`

`max : comparable -> comparable -> comparable`

Find the larger of two comparables.

`min : comparable -> comparable -> comparable`

Find the smaller of two comparables.

`type Order = LT | EQ | GT`

`compare : comparable -> comparable -> Order`

Compare any two comparable values. Comparable values include String, Char, Int, Float, Time, or a list or tuple containing comparable values. These are also the only values that work as Dict keys or Set members.

`not : Bool -> Bool`

`(&&) : Bool -> Bool -> Bool`

`(||) : Bool -> Bool -> Bool`

Note: When used in the infix position, like (left && right) or (left || right) the operator short-circuits.

`xor : Bool -> Bool -> Bool`

`(+) : number -> number -> number`

`(-) : number -> number -> number`

`(*) : number -> number -> number`

`(/) : Float -> Float -> Float`

`(^) : number -> number -> number`

`(//) : Int -> Int -> Int`

Integer division. The remainder is discarded.

`rem : Int -> Int -> Int`

Find the remainder after dividing one number by another.

`(%) : Int -> Int -> Int`

Perform modular arithmetic.

`negate : number -> number`

Negate a number.

`abs : number -> number`

Take the absolute value of a number.

`sqrt : Float -> Float`

Take the square root of a number.

`clamp : number -> number -> number -> number`

Clamps a number within a given range. With the expression clamp 100 200 x the results are as follows:

100 if x < 100 x if 100 <= x < 200 200 if 200 <= x

`logBase : Float -> Float -> Float`

Calculate the logarithm of a number with a given base.

logBase 10 100 == 2 logBase 2 256 == 8

`e : Float`

An approximation of e.

`pi : Float`

An approximation of pi.

`cos : Float -> Float`

`sin : Float -> Float`

`tan : Float -> Float`

`acos : Float -> Float`

`asin : Float -> Float`

`atan : Float -> Float`

You probably do not want to use this. It takes (y/x) as the argument, so there is no way to know whether the negative signs comes from the y or x. Thus, the resulting angle is always between π/2 and -π/2 (in quadrants I and IV). You probably want to use atan2 instead.

`atan2 : Float -> Float -> Float`

This helps you find the angle of a Cartesian coordinate. You will almost certainly want to use this instead of atan. So atan2 y x computes atan(y/x) but also keeps track of which quadrant the angle should really be in. The result will be between π and -π, giving you the full range of angles.

`round : Float -> Int`

`floor : Float -> Int`

`ceiling : Float -> Int`

`truncate : Float -> Int`

`toFloat : Int -> Float`

All angle conversions result in “standard Elm angles” which happen to be radians.

`degrees : Float -> Float`

Convert degrees to standard Elm angles (radians).

`radians : Float -> Float`

Convert radians to standard Elm angles (radians).

`turns : Float -> Float`

Convert turns to standard Elm angles (radians). One turn is equal to 360°.

`toPolar : (Float, Float) -> (Float, Float)`

Convert Cartesian coordinates (x,y) to polar coordinates (r,θ).

`fromPolar : (Float, Float) -> (Float, Float)`

Convert polar coordinates (r,θ) to Cartesian coordinates (x,y).

`isNaN : Float -> Bool`

Determine whether a float is an undefined or unrepresentable number. NaN stands for not a number and it is a standardized part of floating point numbers.

isNaN (0/0) == True isNaN (sqrt -1) == True isNaN (1/0) == False -- infinity is a number isNaN 1 == False

`isInfinite : Float -> Bool`

Determine whether a float is positive or negative infinity.

isInfinite (0/0) == False isInfinite (sqrt -1) == False isInfinite (1/0) == True isInfinite 1 == False

Notice that NaN is not infinite! For float n to be finite implies that not (isInfinite n || isNaN n) evaluates to True.

`toString : a -> String`

Turn any kind of value into a string. When you view the resulting string with Text.fromString it should look just like the value it came from.

toString 42 == "42" toString [1,2] == "[1,2]" toString "he said, \"hi\"" == "\"he said, \\\"hi\\\"\""

`(++) : appendable -> appendable -> appendable`

Put two appendable things together. This includes strings, lists, and text.

"hello" ++ "world" == "helloworld" [1,1,2] ++ [3,5,8] == [1,1,2,3,5,8]

`identity : a -> a`

Given a value, returns exactly the same value. This is called the identity function.

`always : a -> b -> a`

Create a function that always returns the same value. Useful with functions like map:

List.map (always 0) [1,2,3,4,5] == [0,0,0,0,0]-- List.map (\_ -> 0) [1,2,3,4,5] == [0,0,0,0,0] -- always = (\x _ -> x)

`(<|) : (a -> b) -> a -> b`

Backward function application f <| x == f x. This function is useful for avoiding parentheses. Consider the following code to create a text element:

leftAligned (monospace (fromString "code"))leftAligned <| monospace <| fromString "code"

`(|>) : a -> (a -> b) -> b`

Forward function application x |> f == f x. This function is useful for avoiding parentheses and writing code in a more natural way. Consider the following code to create a pentagon:

scale 2 (move (10,10) (filled blue (ngon 5 30)))ngon 5 30 |> filled blue |> move (10,10) |> scale 2

`(<<) : (b -> c) -> (a -> b) -> a -> c`

Function composition, passing results along in the suggested direction.

(g << f) == (\x -> g (f x))

For example, the following code checks if the square root of a number is odd:

not << isEven << sqrt\n -> not (isEven (sqrt n))

`(>>) : (a -> b) -> (b -> c) -> a -> c`

Function composition, passing results along in the suggested direction. For example, the following code checks if the square root of a number is odd:

sqrt >> isEven >> not

`flip : (a -> b -> c) -> b -> a -> c`

Flip the order of the first two arguments to a function.

`curry : ((a, b) -> c) -> a -> b -> c`

Change how arguments are passed to a function. This splits paired arguments into two separate arguments.

`uncurry : (a -> b -> c) -> (a, b) -> c`

Change how arguments are passed to a function. This combines two arguments into a single pair.

`type Never`

A value that can never happen! For context:

The boolean type Bool has two values: True and False

The unit type () has one value: ()

The never type Never has no values!

You may see it in the wild in Html Never which means this HTML will never produce any messages. You would need to write an event handler like onClick ??? : Attribute Never but how can we fill in the question marks?! So there cannot be any event handlers on that HTML.

You may also see this used with tasks that never fail, like Task Never ().

The Never type is useful for restricting arguments to a function. Maybe my API can only accept HTML without event handlers, so I require Html Never and users can give Html msg and everything will go fine. Generally speaking, you do not want Never in your return types though.

`never : Never -> a`

A function that can never be called. Seems extremely pointless, but it can come in handy. Imagine you have some HTML that should never produce any messages. And say you want to use it in some other HTML that does produce messages. You could say:

import Html exposing (..) embedHtml : Html Never -> Html msg embedHtml staticStuff = div [] [ text "hello" , Html.map never staticStuff]

So the **never** function is basically telling the type system, make sure no one ever calls me!