Skip to content

Instantly share code, notes, and snippets.

@jasdev
Last active November 4, 2019 21:16
Pipe Forward
precedencegroup ForwardApplication {
associativity: left
}
infix operator |>: ForwardApplication
func |> <Value, Result>(value: Value, transform: (Value) -> Result) -> Result {
transform(value)
}
precedencegroup BackwardApplication {
associativity: right
}
infix operator <|: BackwardApplication
func <| <Value, Result>(transform: (Value) -> Result, value: Value) -> Result {
transform(value)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment