News for hackers. Stuff that matters.
Re:Railway-oriented programming by bunderbunder on Thursday June 12, 2014 @11:29PM (#7887322)
> I'm not sure why the author goes out of his way to avoid saying "monad,"

Explained here: http://fsharpforfunandprofit.com/about/#banned

Re:Railway-oriented programming by the_af on Friday June 13, 2014 @09:15AM (#7888617)
I understand why they do it, but I think they're doing themselves a disservice. It's one thing to speak in jargon and wrongly assume your audience will follow you:

"So this is obviously a catamorphism. This evidently a job for Kleisli arrows!".

And a completely different thing is to construct a solution step by step, using familiar ideas, and then show that it can be seen as a monad, then give a brief explanation of why monads are useful and what motivates them. Which is exactly what the extremely didactic Learn you a Haskell site does (seriously: look at their example for the Writer Monad. It doesn't get more didactic and step-by-step than that)

By avoiding the correct technical terms, they are:

- Losing precision.

- Failing to generalize the concept.

- Underestimating their audience's ability to understand new concepts when property explained.

The last one in particular kills me. I for one do not assume Visual Basic programmers are incapable or unwilling to learn new things.

Re:Railway-oriented programming by bunderbunder on Friday June 13, 2014 @10:28AM (#7889003)
If you're familiar with the psychological phenomenon known as priming, that may help help to explain the situation. For someone who's suffered through a few too many many blog posts that explain monads poorly, it is possible that simply mentioning the m-word, even in the very last sentence of the article, may inhibit their ability to comprehend the process. Because of that, there's a certain genius to the article's approach: Give folks who've been struggling with monads and arrows the best possible chance to grasp the concept without being encumbered by all the baggage that has built up around the terminology. If they do get the concept, great, and they're virtually guaranteed to realize shortly afterward, "Oh hey, forehead smack, those are monads!"

(Incidentally, for people who've found themselves thrust into this unfortunate situation, a chapter titled A Fistful of Monads probably isn't likely to help much.)

To that end, I'd even go so far as to say your worries about that last bullet point underestimate the audience's ability to understand new concepts when properly explained much worse than the author did.

Re:Railway-oriented programming by steveklabnik on Friday June 13, 2014 @11:53AM (#7889433)
> even in the very last sentence of the article,

I am not a psychologist, but isn't part of the definition of priming that it happens before? How would saying something afterwards harm your ability to previously understand something? Well, I guess I could see how that'd be possible, but I'm not sure that's priming anymore.

Re:Railway-oriented programming by tlarkworthy on Friday June 13, 2014 @12:08PM (#7889526)
I don't read every article top to bottom, I would waste too much time doing that. I read the intro, and if I like, I estimate how long it will take me with a full scroll to the bottom. I also read the bottom so I know the point we are working up to. Sometimes the article is too long and I skip an overly descriptive middle section.
Re:Railway-oriented programming by bunderbunder on Friday June 13, 2014 @01:38PM (#7889955)
With complicated subjects sometimes you need to read the explanation a few times before it completely makes sense.
Re:Railway-oriented programming by the_af on Friday June 13, 2014 @03:00PM (#7890313)
By now I probably sound like a shill, but have you tried reading Learn you a Haskell? There is nothing scary about it, it really is very simple and didactic. Chapter titles are funny: anyone who finds a title such as A Fistful of Monads next to a colorful drawing of The Man with No Name scary is beyond help... :)

I disagree I'm underestimating anyone. I'm advocating teaching people. If you never tell them about monads, they can never realize they've been using them on their own, simply because no-one is ever going to mention monads to them. It just doesn't work like that; at some point someone must tell you about them (a blog or a paper counts in this context).

Re:Railway-oriented programming by bunderbunder on Saturday June 14, 2014 @12:08PM (#7893026)
In your haste, you've forgotten one of the key premises of this line of discussion.

How can someone have gotten themselves into a situation where the very mention of the word 'monad' generates feelings of frustration and simultaneously never have heard about monads?

Re:Railway-oriented programming by grndn on Friday June 13, 2014 @03:19PM (#7890381)
From "A Fistful of Monads" chapter in "Learn you a Haskell"

> When we first talked about functors, we saw that they were a useful concept for values that can be mapped over. Then, we took that concept one step further by introducing applicative functors, which allow us to view values of certain data types as values with contexts and use normal functions on those values while preserving the meaning of those contexts.

> In this chapter, we'll learn about monads, which are just beefed up applicative functors, much like applicative functors are only beefed up functors

> Monads are a natural extension of applicative functors and with them we're concerned with this: if you have a value with a context, m a, how do you apply to it a function that takes a normal a and returns a value with a context? That is, how do you apply a function of type a -> m b to a value of type m a?

Some people might find this easy to understand, but I guess that many people won't. I don't think that it is because they are stupid, rather that most people are concrete thinkers rather than abstract thinkers.

You would expect programmers to be more comfortable with abstraction than the general population, but even so, in my experience, the level of abstraction that mathematicians use is a level too far for most programmers.

Why should a concept be generalized when you are just learning it? Would you complain that a elementary book on arithmetic fails to mention that the integers form a ring? And that addition is just a special case of a monoid? What advantage is there to this kind of premature generalization?

Re:Railway-oriented programming by the_af on Friday June 13, 2014 @07:57PM (#7891449)
But all those concepts -- functors, applicative functors and monoids -- have already been explained with didactic examples in previous chapters of LYAH.

Of course, you cannot expect to jump to any point in the middle of a book or article explaining something you don't know and expect to understand every bit of terminology. Without knowing C++ or OOP, would you jump to the middle of an "OOP with C++" blog and expect to understand the terminology? Ok, answer quickly: what's a method? What's a template? What's the difference between class and instance? What does "static" do? (I hope you get the idea).

There is nothing particularly difficult about Haskell, Monads or FP at the level that is taught in LYAH. Seriously. Sure, there is hard to read code in real Haskell projects (much as it happens with C++, by the way), but not in this tutorial.

This argument about "many people won't understand new or abstract terminology" is pretty weak and I'm having trouble with people buying it. Programming IS abstract, but we all learned it. We all were new to crazy new terms like "overloading" and "operator precedence" and it didn't deter us. So why on Earth are we deciding that "Monad" and "Functor" are too difficult?

Re:Railway-oriented programming by slapresta on Friday June 13, 2014 @07:25AM (#7888212)
So they decide to cripple themselves, intentionally restricting their knowledge to avoid being seen as pedantic? I could understand trying to avoid those words for beginners, but it doesn't seem like the site targets beginners only.
Re:Railway-oriented programming by andor on Friday June 13, 2014 @09:26AM (#7888674)
He explains how and why his code works. Adding too much formal terminology would make it seem like there is another layer of theory you need to grasp before you truly understand what's going on. Complicated terminology is elitist to beginners, because it nullifies first successes in understanding functional programming.
Re:Railway-oriented programming by dons on Friday June 13, 2014 @03:31AM (#7887763)
Because using sloppy language is so much better...