Continuing and summarising from my two previous posts here and here …
…as a person very new to programming in general I decided to try and learn Elm.
To do this I am trying to go through the Elm-Guide and, so far, I have stumbled upon two rough patches.
The first was at the end of the Elm Architecture / Form section.
One exercise asked the user to add a “Submit” button that would show eventual validation errors only after being clicked.
To me this was quite difficult.
Later I discovered that the following chapter Types actually clarified a lot of the things that had puzzled me, and even talked about refactoring … if the Submit Button exercise had been offered here, I believe my life would have been much easier.
As already stated, this would be my ideal Guide order:
- Introduction
- Install
- Core Language
- The Elm Architecture
– Buttons
– Text Fields
– Forms ( without the final button exercise ) - Types
– Reading Types
– Type Aliases
– Custom Types
– Pattern Matching
– Forms ( refactoring + final button exercise )
The second moment of panic is happening right now, at the end of the Commands and Subscriptions / Random section.
The problem is, again, the last part of the exercise where I am asked to “have the dice flip around randomly before they settle on a final value”.
Even asking for help on this forum AND in the official slack channels (were I got some help from a few very nice people) I am far from solving the task.
One guy helped me figure out that instead of calling the function to roll dice multiple times, I could instead generate a list of random numbers (a list of dice rolls).
And then I could pass that, one head at a time, to the view.
But the syntax handling all of this is not clear to me.
And then any attempt I make seems to fuck up the Update function, because the Types mismatch… I can’t just write functions to do what I want, they have to be of the right Type… and this is making me go nuts!
It was suggested that I might need stuff from the Task package in order to fix this.
And I have not even started to think about how am I supposed to make the multiple dice rolls be visible to the user; if I ever manage to fix all my current problems, the end result will be a number-change so fast that no one will see it.
Maybe I’m missing something obvious, but this task at the moment feels insurmountable and very disheartening.
After about a week of banging my head on it, I’ve decided to ignore it for now, and move on to the next Guide section, hoping to one day come back to with the sufficient knowledge to solve it.