Hacker News new | ask | show | jobs
by GhotiFish 4849 days ago
This is another thing I persistently thought while I was learning Haskell

   "It's a paradigm shift, you're used to programming
    imperatively, this is not imperative. Think back to when
    you first started programming, you got caught on doing
    simple things, right? This is the same."
On sober reflection, I don't buy this logic any more. Haskell's ability to be generic is really cool, so cool that it has a massive standard library of itemized, tried and tested bits of logic that can be used anywhere, and I do mean anywhere. All of which you as a new programmer are tasked with getting acquainted with. As a new programmer you must abstract your program out in a way that fits one or more these component pieces, that can fit the standard library. Ouch.

Of course, this library only gives you a toolbox to cover some fundamental logic, you can express really interesting things in short lines if you're skilled enough to abstract your problem out into general behaviour. Even I got this far, but when the problem your working on is best modelled through state, which is basically everything, you now have to understand monads.

What portion of the population do you think can utter these words confidently? "I Understand Monads"

Haskell provides no ramp up, there is no learning curve. I don't believe Haskell's problem is that it's different, I believe it's problem is that it's different and difficult.

1 comments

It is different and difficult. I think that's because functional programming isn't simply a sideways step from imperative programming, but is instead a level of abstraction higher than imperative programming.

Hofstadter says analogy is the core of cognition. We tie unknown things to known things to understand them, and I think that's why you get all these bad analogies where people try to tie the more abstract concepts of fp like monads to everyday things ( "monads are like burritos," for example).

And this really doesn't make sense because monads and such are pure abstractions. How do you tie a pure abstraction to something concrete? It's like saying zero is like a burrito.

The better analogies tie pure abstractions like monads and arrows to other abstractions that you already understand. For instance, Odersky trains you by iteratively refactoring imperative Scala code into more functional code, and thereby gradually carrying you up the ladder of abstraction.