curry : (( a, b ) -> c) -> a -> b -> c
Given a function with a single argument as pair, returns its curried version
sumPair : (Int, Int) -> Int -> Int
sumPair (x, y) = x + y
curriedSum : Int -> Int -> Int
curriedSum x y = curry sumPair
uncurry : (a -> b -> c) -> ( a, b ) -> c
Given a function with two (curried) arguments, returns a function whose only argument is a pair
curriedSum : Int -> Int -> Int
curriedSum x y = x + y
sumPair : (Int, Int) -> Int -> Int
sumPair = uncurry curriedSum
flip : (a -> b -> c) -> b -> a -> c
Flips the first two (curried) arguments of a function
cons : a -> List a -> List a
cons = (::)
flippedCons : List a -> a -> List a
flippedCons = flip cons
ifThenElse : Basics.Bool -> a -> a -> a
If function
ifThenElse True "x" "_" -- => "x"
ifThenElse False "_" "x" -- => "x"
ifThenMap : (a -> Basics.Bool) -> (a -> a) -> a -> a
Maps the value whether the given predicate holds true for that value
showResults : List String -> List String
showResults xs =
xs
|> ifThenMap List.isEmpty
(\_ -> [ "Cannot find users matching this query" ])
ifThenElseMap : (a -> Basics.Bool) -> (a -> b) -> (a -> b) -> a -> b
Conditional if that can be used in update circuits to avoid parenthesis/anonymous functions eg.
model
|> doSomethingNiceWithModel
|> ifThenElseMap someBooleanConditionBasedOnModel
changeModelIfTrue
changeModelIfFalse
|> withoutCmds []