How to learn PureScript in 2020?

@Ding have you seen this implementation of todomvc with react-basic?

1 Like

Wow. That video is really nicely-done.

2 Likes

We should consider to perhaps tell our “aha moments” when when introducing programmers to Haskell and PureScript.

I’m currently trying to learn Lisp and it’s hard for me to understand what the big deal is. Every tutorial is about s-expressions, car and cdr. I’m sitting here thinking “yeah ok, what’s the point?” I used to have a similar problem when learning Haskell; every tutorial was showing how to implement the bloody factorial function.

The YouTuber of FunFunFunction said “if someone demonstrates Haskell by showing you how to implement the factorial function you must immediately murder them”. He was joking of course. But I think he was speaking to the frustrating fact that it’s like you know how to use an axe, and some people tell you how great chainsaws are, but when you inspect the chainsaw it looks like it wouldn’t be very good for >hacking< down trees with. When you ask why it’s so great, someone starts talking about how nice the grip feels in your hand and that it only weighs x kg. You think “my axe also feels great in my hand and it weighs a lot less than x kg”.

I am just as guilty of this by the way. At my last employer we used Haskell and we had a senior C# developer start there. In the beginning he tried to get a debugger working but had issues so he asked us for help. I remember not understanding why he was wasting his time with debuggers but I said nothing. “Why would you need a debugger when you have no bugs?” I thought arrogantly in the back of my mind. (Obviously we have bugs in Haskell code bases but not nearly to the same degree as you get in mainstream code bases) I wish I had explained this to him. A year later he told me about how inconceivable it was for him when he first started with Haskell to code without a debugger, without stepping through code, inspecting state, changing state, change code while application is running etc. He explained his “aha moment” was something along the lines of “with immutable pure function and with no temporal complexity you don’t need a debugger, unit testing is enough”.

When I first examined Haskell I thought the ecosystem seemed small, unmaintained and perhaps a little dead. Haskell didn’t click for me until I started using PureScript. I noticed the same thing with PureScript; the small ecosystem of libraries - except for one little detail - there were a set of modules with lots of little functions for dealing with various situations, like Control.Monad, the algebraic structures like Semi Group etc and they were the exact same functions in Haskell. Too much of a coincidence! I realized that you can get very very far with these functions. You constantly find yourself in little situations when coding Haskell where your type looks like A but you need a B. Hoogle “A -> B” and usually you find what you need. I wish I was told this. We take it for granted but it’s a very different idea from most other languages. Take void :: forall f a. Functor f => f a -> f Unit, such a simple little thing. What upgrade would it need? What could replace it? I wish I was told this.

7 Likes

Re: aha! moments, one big aha! moment for me was reading or listening, to an interview with Ed Kmett saying that he’d sort of tried to learn Haskell a few times and it was only on his third or fourth attempt that he got into it. Hearing someone of that stature in the community say that really gave me a lot of motivation to work thru discouragement and impostor syndrome feelings about not “getting it”

(not to say it has to be that hard for everyone, just that it’s totally fine to have to struggle a bit with it if you do find it hard)

another really useful motivating analogy that i have used when teaching people this stuff is to think of it as learning the rules of chess in 20 minutes but it taking a lot longer to learn to play actually play chess. And there’s not a sudden satori moment of “understanding chess”…something very similar occurs with Functor-Apply-Bind-Applicative-Monad, i think.

6 Likes

That was a great article, not just about LYAH but also the strengths & weaknesses of a number of other Haskell learning resources. It also links to a guide to how to start learning Haskell. His recommendation is:

  1. Brent Yorgey’s UPenn CIS 194 course from Spring 2013, and then
  2. Tony Morris & Mark Hibberd’s Functional Programming Course

I’m going to try to go through those since I’m still kind of new to both Haskell and PureScript.


Chris Allen makes another point that I think bears repeating:

The existing texts for Haskell aren’t using an informed pedagogical discipline.

That is, there is a field of study on effective teaching – and attempts to create or improve learning resources should take advantage of it!

2 Likes