Function Reference

General Functions

id

id : forall a. a -> a

The identity function does nothing and just returns its value.

const

const : forall a b. b -> a -> b

The function const a always returns a.

flip

flip : forall a b c. (a -> b -> c) -> b -> a -> c

apply

apply : forall a b. (a -> b) -> a -> b

(<|)

Infix operator alias for apply. right-associative, precedence: 0

Apply the function on the left-hand side to the argument on the right-hand side.

applyFlipped

applyFlipped : forall a b. a -> (a -> b) -> b

(|>)

Infix operator alias for applyFlipped. left-associative, precedence: 1

Apply the function on the right-hand side to the argument on the left-hand side.

compose

compose : forall a b c. (b -> c) -> (a -> b) -> a -> c

(<<<)

Infix operator alias for compose. right-associative, precedence: 9

composeFlipped

composeFlipped : forall a b c. (a -> b) -> (b -> c) -> a -> c

(>>>)

Infix operator alias for composeFlipped. right-associative, precedence: 9

Boolean Values

Boolean

type Boolean

Constructors

conj

conj : Boolean -> Boolean -> Boolean

Conjunction of two booleans. The result is true if both arguments are true.

(&&)

Infix operator alias for conj. right-associative, precedence: 3

disj

disj : Boolean -> Boolean -> Boolean

Disjunction of two booleans. The result is true if the first, the second, or both arguments are true.

(||)

Infix operator alias for disj. right-associative, precedence: 2

not

not : Boolean -> Boolean

Negate a boolean value.

Numeric Values

Num

interface Num x where

Methods

Implementations

(+)

Infix operator alias for add. left-associative, precedence: 6

(-)

Infix operator alias for sub. left-associative, precedence: 6

(*)

Infix operator alias for mul. left-associative, precedence: 7

(/)

Infix operator alias for div. left-associative, precedence: 7

roundTo

roundTo : Integer -> Number -> Number

For example, the expression roundTo 2 n rounds the number n to a

toNumber

toNumber : Integer -> Number

Equality

Eq

interface Eq a where

Interface of types where elements can be compared to each other.

Methods

Implementations

(==)

Infix operator alias for eq. non-associative, precedence: 4

notEq

notEq : forall a. Eq a => a -> a -> Boolean

Returns true if both arguments are not equal.

(/=)

Infix operator alias for notEq. non-associative, precedence: 4

Ordering

Ordering

type Ordering

The type returned by compare.

Constructors

Ord

interface Eq a => Ord a where

Interface of types that can be ordered.

Methods

Implementations

lessThan

lessThan : forall a. Ord a => a -> a -> Boolean

Returns true if the first argument is less than the second.

(<)

Infix operator alias for lessThan. left-associative, precedence: 4

greaterThan

greaterThan : forall a. Ord a => a -> a -> Boolean

Returns true if the first argument is more than the second.

(>)

Infix operator alias for greaterThan. left-associative, precedence: 4

lessThanOrEq

lessThanOrEq : forall a. Ord a => a -> a -> Boolean

Returns true if the first argument is less than or equal to the second.

(<=)

Infix operator alias for lessThanOrEq. left-associative, precedence: 4

greaterThanOrEq

greaterThanOrEq : forall a. Ord a => a -> a -> Boolean

Returns true if the first argument is more than or equal to the second.

(>=)

Infix operator alias for greaterThanOrEq. left-associative, precedence: 4

min

min : forall a. Ord a => a -> a -> a

max

max : forall a. Ord a => a -> a -> a

Pairs

Pair

type Pair a b

Constructors

Lists

List

type List a

Constructors

member

member : forall a. Eq a => a -> List a -> Boolean

sum

sum : forall a. Num a => List a -> a

Calculates the sum over a list of numbers.

length

length : forall a. List a -> Integer

Get the length of a list.

filter

filter : forall a. (a -> Boolean) -> List a -> List a

Filter a list according to the given predicate. For example,

predicate x = x.Temperature >= 0 && x.Temperature <= 10
filter predicate #Cities

would filter the rows of the "Cities" table to include only those where the temperature is between 0 and 10 degrees.

find

find : forall a. (a -> Boolean) -> List a -> Maybe a

Find the first element in a list that matches the given predicate, or return Nothing.

concat

concat : forall a. List (List a) -> List a

Flatten a list of lists.

any

any : forall a. (a -> Boolean) -> List a -> Boolean

all

all : forall a. (a -> Boolean) -> List a -> Boolean

Maybe Values

Maybe

type Maybe a

Constructors

maybe

maybe : forall a b. b -> (a -> b) -> Maybe a -> b

The expression maybe b f x applies the function f to the content of x, or just returns b, if x is Nothing.

fromMaybe

fromMaybe : forall a. a -> Maybe a -> a

The expression fromMaybe 0 x returns the content of x if there is one, or 0 in case of Nothing.

mapMaybe

mapMaybe : forall a b. (a -> Maybe b) -> List a -> List b

Either Values

Either

type Either a b

Constructors

either

either : forall a b c. (a -> c) -> (b -> c) -> Either a b -> c

Containers

Functor

interface Functor f where

Interface of types that represent "containers" which can be mapped over.

Methods

Implementations

Appendable Values

Semigroup

interface Semigroup a where

Interface of types where elements can be "appended" to one another.

Methods

Implementations

(<>)

Infix operator alias for append. right-associative, precedence: 5

Foldable Values

Foldable

interface Foldable f where

Methods

Implementations

Printable Values

Print

interface Print a where

Interface of types that can be converted into a String.

Methods

Implementations

Formatting

formatNumber

formatNumber : String -> Number -> String

A call like formatNumber s x formats the number x according to the format string s. For a list of formatting characters, see here.

formatDateTime

formatDateTime : String -> DateTime -> String

formatDateTime s t formats time t according to the format string s. For a list of formatting characters see here.

Date and Time

year

year : DateTime -> Integer

Returns the year of a given time.

month

month : DateTime -> Integer

Returns the month of the year (1-12) of a given time.

day

day : DateTime -> Integer

Returns the day of the month (1-31) of a given time.