dwyl / learn-elm

:rainbow: discover the beautiful programming language that makes front-end web apps a joy to build and maintain!
https://github.com/dwyl/learn-elm
483 stars 43 forks source link

Elm for Kids #89

Open YvesMuyaBenda opened 7 years ago

YvesMuyaBenda commented 7 years ago

It is what it says on the tin

nelsonic commented 7 years ago

@YvesMuyaBenda that's a fantastic link! we should add it to the readme ASAP! Do you have time for a quick PR? e.g: above the https://github.com/dwyl/learn-elm#in-depth-step-by-step-tutorial-60mins section?

YvesMuyaBenda commented 7 years ago

@nelsonic I am happy for your enthusiasm; however, if I am to be responsible for linking beginners to an Elm tutorial, as opposed to just saying, "People, people, this is aweeeeeesome!"; then it is my moral obligation to actually, uhm, try the tutorial out to see what problems a raw beginner might have.

The main problem with the tutorials is that the language used is outdated. I currently see two main problems.

Attempting to compile the code in the tutorial Elm: Mouse in Try Elm, I got the following syntax error:

I ran into something unexpected when parsing your code! 22| stopX (x,y) = (if | x > 100 -> 100

I am looking for one of the following things:

an expression
whitespace

The cause of the error is that multiline-if is no more!

The changes needed in the code to get it to compile are all similar to:

From

stopX (x,y) = (if | x > 100 -> 100 | otherwise -> x
, y)

to

stopX (x, y) = ( if x > 100 then 100 then 100 , y)

Now that is a simple syntactic change with minimal change to the exposition, could be done relatively quickly; but the more significant change is that signals are no more!. I did find this cool blog on moving transformations away from signals. Now, apparently the change is not supposed to be that difficult, also given that we are working with simple examples, but it exceeds my current conceptual grasp. I am more than happy to turn it into a little research project to get more into Elm, but if someone with more Elm know-how could rewrite the code to use subscriptions and change the corresponding exposition, then we are good to go! We could even write to Mcmasters to get them to update the code in their cool tutorials!