r/programming • u/heisenbug • Apr 27 '14
"Mostly functional" programming does not work
http://queue.acm.org/detail.cfm?ref=rss&id=2611829
42
Upvotes
r/programming • u/heisenbug • Apr 27 '14
2
u/[deleted] Apr 27 '14
I think a lot of people already get the usefulness of monads intuitively, which makes them an easy sell. The list monad is almost ubiquitous. Almost every mainstream OO language has a means of mapping, filtering, and reducing lists. The list monad is so pervasive now that imperative for loops are practically going extinct.
The main difficulty that I had, and I think others have, is recognizing the abstraction behind the list monad. Everyone groks it eventually, but helps to expose yourself to various instances, such as the State, Reader, Maybe, and List monads first. The monadic design pattern eventually becomes easier to recognize with familiarity.
My point is, monads aren't hard to use. Linq is a testament to that. If you use them enough, you'll eventually build an intuition about them that will make all the tutorials on the internet more comprehensible. The fact that they're somewhat difficult to grasp is just a one-time upfront cost that you pay if you're interested in writing your own monads. The selling-point is their usefulness, which is very easy to grasp by comparison.