Skip to content

Pipelines

|> passes its left-hand side as the first argument of the call on the right. Pipelines check against ordinary function signatures. Dot calls dispatch through modules and values of mod types.

module pipe
fn add(n: Integer, amount: Integer) -> Integer {
n + amount
}
fn twice(n: Integer) -> Integer {
n * 2
}
pub fn scale(n: Integer) -> Integer {
n
|> add(5)
|> twice()
|> add(1)
}