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 curriedSumFlips the first two (curried) arguments of a function
cons : a -> List a -> List a
cons = (::)
flippedCons : List a -> a -> List a
flippedCons = flip consIf function
ifThenElse True "x" "_" -- => "x"
ifThenElse False "_" "x" -- => "x"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" ])Conditional if that can be used in update circuits to avoid parenthesis/anonymous functions eg.
model
|> doSomethingNiceWithModel
|> ifThenElseMap someBooleanConditionBasedOnModel
changeModelIfTrue
changeModelIfFalse
|> withoutCmds []
Given a function with a single argument as pair, returns its curried version