/pipe_forward.swift Secret
Last active
November 4, 2019 21:16
Pipe Forward
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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