@grigorious @dwayne @novid @grrinchas @ymtszw So it seems like @lydell was correct that there are lots of ways to go about form validation!!
I quite like the idea of parsing the form inputs before they reach the type
to be stored as Elm data (either with an intermediary type, or validating inputs before they’re stored), but each of these methods could warrant their own chapter in a book!!
As with a lot of things Elm related, I know enough to see how some of the pieces work, but not enough to understand how things fit together at scale.
Elm Spa is too advanced for me, although I understand bits of the form validation page — @dwayne solution does look similar to Elm’s json decoder but I’ve never used Cmd.map
and only understand 60% of the rest.
Elm form decoder looks like a neat solution, catching errors before they reach the Goat
type — but that blog post is quite a lot simpler than the given Github example. There’s still a lot of question marks, such as “how do you render the specific error next it’s form field”, and more general questions about how it all fits together. I’d also be a little cautious about it’s longevity should Elm get updated.
I’m almost done with “Elm in Action” book, which goes a long way to explaining basic features in Elm, but going from that to working with package documentation and figuring out how the pieces fit together is a big problem (for me).
So yeah, for each of these I think I’d need an “Explain it like I’m 5” blog post(s) — they’re quite complex. A simplified, well-commented Ellie App might go a long way too
Perhaps this course on elm-validate
might help me understand also? I think Elm has lost a really good teacher with @rtfeldman moving to Roc Lang.
Thanks all!