News for hackers. Stuff that matters.
Re:What are potential disadvantages of functional programming? by darkkindness on Thursday July 27, 2017 @08:08PM (#14870922)
In my own (limited) experience, I'd much rather debug a nasty pointfree expression than debug a deep nest of loops keeping state in mind.

Perhaps it is just different kinds of cognitive overhead.

Re:What are potential disadvantages of functional programming? by seanmcdirmid on Thursday July 27, 2017 @10:57PM (#14871592)
How would you even go about stepping through a pointsfree expression though? Have Haskell/scala debuggers improved significantly in this regard?
Re:What are potential disadvantages of functional programming? by darkkindness on Friday July 28, 2017 @03:23PM (#14876805)
I wasn't aware these debuggers existed. I'll have to check them out.

The purpose of writing point-free functions is to encourage thinking about chaining functions together instead of considering what really happens to low-level values. It's like using pipelines. This means that for debugging, "stepping through" wouldn't help you much IMO even if you could do it![0] (A whiteboard might help, though.)

I'll try to give an example: if you're looking at an unnecessarily point-free expression like "mapReduce = (. map) . (.) . foldr1", the logic is difficult to read. I'm not an expert in point-free-fu yet, so in that case I'd recommend pointful[1], which deobfuscates that expression to "mapReduce x x0 x2 = foldr1 x (map x0 x2)", a map followed by a fold. So the problem is again reduced to looking how functions are being chained together. For larger examples of point-free expressions I'd try to isolate individual functions as where clauses.

[0] As mentioned by cgmg, the Writer monad is useful if you need to know the values going in and out of functions. [1] http://github.com/23Skidoo/pointful

Re:What are potential disadvantages of functional programming? by cgmg on Thursday July 27, 2017 @11:39PM (#14871776)
You should try the Writer monad, which adds an extra value for logging: http://learnyouahaskell.com/for-a-few-monads-more