Re:Pipelining might be my favorite programming language feature
by Symmetry on Monday April 21, 2025 @10:39AM
(#43752525)
I feel like Haskell really missed a trick by having $ not go the other way, though it's trivial to make your own symbol that goes the other way.
[ Parent
| on HN ]
Re:Pipelining might be my favorite programming language feature
by jose_zap on Monday April 21, 2025 @10:46AM
(#43752601)
Haskell has & which goes the other way:
users
& map validate
& catMaybes
& mapM persist
Re:Pipelining might be my favorite programming language feature
by taolson on Monday April 21, 2025 @11:59AM
(#43753444)
Yes, `&` (reverse apply) is equivalent to `|>`, but it is interesting that there is no common operator for reversed compose `.`, so function compositions are still read right-to-left.
In my programming language, I added `.>` as a reverse-compose operator, so pipelines of function compositions can also be read uniformly left-to-right, e.g.
process = map validate .> catMaybes .> mapM persist
Re:Pipelining might be my favorite programming language feature
by 1-more on Monday April 21, 2025 @12:55PM
(#43754000)
Elm (written in Haskell) uses |> and <| for pipelining forwards and backwards, and function composition is >> and <<. These have made it into Haskell via nri-prelude https://hackage.haskell.org/package/nri-prelude (written by a company that uses a lot of Elm in order to make writing Haskell look more like writing Elm).
There is also https://hackage.haskell.org/package/flow which uses .> and <. for function composition.
EDIT: in no way do I want to claim the originality of these things in Elm or the Haskell package inspired by it. AFAIK |> came from F# but it could be miles earlier.
Re:Pipelining might be my favorite programming language feature
by shadytrees on Monday April 21, 2025 @10:21PM
(#43758536)
Maybe not common, but there’s Control.Arrow.(>>>)