News for hackers. Stuff that matters.
Re:When Does Point-Free Notation Make Code More Readable? by ArchReaper on Friday September 29, 2017 @11:03AM (#15365902)
This seems like a great way to obfuscate all your code without any actual benefit. Can anyone give me a real example of how this is somehow a better way to do things? Maybe the application for this is only for a specific field that I'm not familiar with?
Re:When Does Point-Free Notation Make Code More Readable? by mrkgnao on Friday September 29, 2017 @11:49AM (#15366319)
Working with streams of data often makes pointfree syntax beneficial, since you can start to see the omitted arguments "flow" through your chain of composed functions. If you write

   f # g = \x -> g (f x)
then you could implement functions like this:

   f :: Stream Int -> Stream Int
   f = drop 3       -- drop the first three elements
     # skipEvery 3  -- skip every third element
     # sumEvery 2   -- sum every consecutive pair of elements
     # map (* 2)    -- double everything
This would turn

   1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...
into

   2 * (4 + 5), 2 * (7 + 8), 2 * (10 + 11), ...
You can find many non-pointfree versions of similar streaming code here: https://github.com/snoyberg/conduit/