Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Add %revapply as a primitive (for infix pipe) #5236
Original bug ID: 5236
One emerging idiom (at least in jane street's code base) is to define a pipe operator to string computations as such:
let (|>) x f = f x
This, sadly, does come with a performance hit (enough that we've actually seriously considered ). The attached patch introduces a new primitive (%revapply) that can be used to define |>:
external (|>) : 'a -> ('a -> 'b) -> 'b = "%revapply"
Feedback and comments would be greatly appreciated.