In F#, use of the the pipe-forward operator, |>, is pretty common. However, in Haskell I’ve only ever seen function composition, (.), being used. I understand that they are related, but is there a language reason that pipe-forward isn’t used in Haskell or is it something else?
In F#, use of the the pipe-forward operator, |> , is pretty common. However,
Share
I am being a little speculative…
Culture: I think
|>is an important operator in the F# “culture”, and perhaps similarly with.for Haskell. F# has a function composition operator<<but I think the F# community tends to use points-free style less than the Haskell community.Language differences: I don’t know enough about both languages to compare, but perhaps the rules for generalizing let-bindings are sufficiently different as to affect this. For example, I know in F# sometimes writing
will not compile, and you need explicit eta-conversion:
to make it compile. This also steers people away from points-free/compositional style, and towards the pipelining style. Also, F# type inference sometimes demands pipelining, so that a known type appears on the left (see here).
(Personally, I find points-free style unreadable, but I suppose every new/different thing seems unreadable until you become accustomed to it.)
I think both are potentially viable in either language, and history/culture/accident may define why each community settled at a different “attractor”.