Elm Language Functions and Partial Application Infix operators and infix notation


Example

Elm allows the definition of custom infix operators.

Infix operators are defined using parenthesis around the name of a function.

Consider this example of infix operator for construction Tuples 1 => True -- (1, True):

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

Most of the functions in Elm are defined in prefix notation.

Apply any function using infix notation by specifying the first argument before the function name enclosed with grave accent character:

import List exposing (append)


append [1,1,2] [3,5,8]   -- [1,1,2,3,5,8]
[1,1,2] `append` [3,5,8] -- [1,1,2,3,5,8]