News for hackers. Stuff that matters.
Re:8 months of OCaml after 8 years of Haskell in production ... by worksonmymach on Tuesday December 03, 2024 @02:38AM (#42303812)
1. Change . to |

2. Reverse

Now you have:

words | map read | sum

Or..

$ cat words | map -e read | sum

Re:8 months of OCaml after 8 years of Haskell in production ... by tromp on Tuesday December 03, 2024 @03:56AM (#42304240)
Would you propose the same change for nested function calls y = f(g(h(x))), changing it into y = x | h | g | f ?
Re:8 months of OCaml after 8 years of Haskell in production ... by worksonmymach on Tuesday December 03, 2024 @04:27AM (#42304414)
It can look nice. It is like asking: passive or active voice? It depends what you are writing and what makes sense to the reader.

I do like pipelines though!

Re:8 months of OCaml after 8 years of Haskell in production ... by bhargav on Tuesday December 03, 2024 @05:05AM (#42304598)
Yes but the notation of dot, plus such function names plus optional parens makes it sure read like English. That’s great but it’ll be a nightmare when you are also dealing with strings which similar English in it.
Re:8 months of OCaml after 8 years of Haskell in production ... by kreyenborgi on Tuesday December 03, 2024 @03:15PM (#42310775)
|> is a common way of writing the pipe in haskell, so

     words |> map read |> sum
IHP uses it a lot.