Comment

Comment by samdk

The parallels to Unix are strong enough that having an actual pipe operator can be very useful. I frequently write code that looks something like this:

    List.map data ~f:(fun elem -> ...)
    |! List.find ~f:( ... )
    |! Option.map ~f:( ... )
    
(This is OCaml, not Haskell, but the syntax is similar.) The definition of the '|!' operator is quite simple:

    let (|!) x f = f x
parent samdk 14 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton