2 ms·
Because you're already used to a very different approach to express the solution to a problem. It is like somebody who already knows an western language trying
by marcodiego 5y ago
Because you're already used to a very different approach to express the solution to a problem. It is like somebody who already knows an western language trying to suddenly learn Mandarin.
- Jtsummers 5y agoHah, I was pondering how to write a longer comment expressing this same thing so I'll piggyback on yours. Paradigms are modes of thinking. You can't just pick up a new paradigm on the fly when you've spent your entire life in another one. Some individuals are exceptions, but most of us aren't so lucky as to have such a natural aptitude for changing our minds on the fly. In order to be introduced to a new paradigm you have a couple options: 1. Sink or swim. In Haskell, this is the monad tutorial. Why the hell do people start their instruction here? Did they start here? If they did, did they succeed from that point or did they have to find another path and just forgot that this was a really stupid way to start? 2. Baby steps. "See Spot. See Spot run. Run Spot, run!" Learning Italian (previously Spanish), this is literally the level I'm at (actually, a bit better, but still highly constrained by my limited vocabulary). In Haskell, this is: double :: Int -> Int double x = 2 * x quadruple :: Int -> Int quadruple x = double (double x) Simple functions tested in the REPL. Then you teach them about function composition (drawing on their knowledge from mathematics, where it's the same idea and not merely an analogous idea) and make a point-free version of quadruple. Then you show how functions can be passed around so that you can do: square_function f = f . f quadruple = square_function double Maybe give that first function a better name, my coffee hasn't kicked in yet. My point, though, is that functional programming in Haskell does not rely on monads when teaching the topic. There are a million things to teach before you even reach that point, and only once the student has a foundation in Haskell's syntax, base semantics, and type system do they need to be introduced to monads. At which point it'll make a lot more sense because they'll be able to grok what monads add to the language. By analogy (hah!), we don't start C language learners with implementing a generic swap or sort function. That would be way beyond their initial capability, relying no too many ideas that they have no foundation for (that said, it's a shorter path to that in C than monads in Haskell). So why do people think that learning a totally novel (to them) paradigm like functional programming, especially in the uber-FP language Haskell, can be done by starting at the deep end without studying its fundamentals?
- nowherebeen 5y agoI equate it to a skier learning to snowboard. A skier points their toes downhill to go down the mountain; a snowboarder points their toes perpendicular. Once you are used to pointing your toes downhill, its very hard for the mind to switch context to perpendicular because your mind is telling you that's how you stop.