You get excited about Elm, so you breeze through the Elm guide, and get a few simple examples running. Then you come up with a great project idea, make a start on it and... things grind to a halt.
Now that you need a real world data model, a sophisticated UI and fully fleshed out interactions, Elm starts to feel truly cryptic and you start getting really frustrated. You want to make progress, but you just keep hitting one brick wall after another.
You start working out how to make a server request, and you find the type signature for
send : (Result Error a -> msg) -> Request a -> Platform.Cmd.Cmd msg
What the hell is this supposed to mean?! You find yourself staring at the docs and trying to reason it out, again and again.
Then you have to write a JSON decoder for nested arrays within objects within arrays:
You spend half a day combining JSON functions this way and that, but you just can't seem to get it right. You start getting a new appreciation for
Turn your attention to styling your pages, and it threatens to turn into another headache:
Elm styling options:
- Inline styles
- Separate stylesheet
This doesn't look straightforward! What is the right way to handle styles?
"I still don't feel like I really understand how to write code in Elm"
I know how that feels. When I first found out about Elm, I was excited by its potential to eliminate runtime errors and make development a more fun experience for my team. I was super motivated to learn it. There were plenty of beginner Elm tutorials, and it's easy to learn the Elm syntax and concepts (it's simple by design after all!).
However, I still found myself flailing when I tried to go beyond the simple counter and TODO list examples, because information available online quickly gets sparse.
There is still a chasm between learning the basic concepts of Elm, and using it to create complex real world applications - the kind that you'd release into production at work.
What if you could skip the frustration of figuring things out from meandering blog posts, scant tutorials, and terse package READMEs?
You will start to benefit from Elm's type system and write reliable, exception-free code.
It will NOT rehash the basics that you can easily pick up from the Elm guide and other online resources: no explaining why functional programming is great, or why we want currying, or what union types are. I don't want to waste your time on stuff you already know.
What does the book cover?
The focus of the book is on practical topics:
- A discussion of options for creating UIs and styling
- Approaches and tools for preventing and finding bugs
- JSON parsing (the most commonly reported problem Elm newcomers face)
- Making server requests and working with commands
- JS interop and ports
- A discussion of code organisation as your application grows
- An example of integrating a rich editor with the help of custom elements
- A discussion of integrating Elm into a JS application
- An in-depth look at language features such as pattern matching
- Tools for being more productive when writing Elm code
What do people say about the book?
It's early days yet, but here are some of the things people had to say about the book:
"I'm liking the book so far and am looking forward to what you have in store for the rest of the chapters.
Being introduced to elm-analyse made me go back to previous projects, start linting them, and add elm-analyse to their build pipelines."
— Paul Fioravanti
"What I really appreciate and enjoy in the book is the way you incrementally refactor the application to introduce
a different way to model the data that solves the problem. I like when the type system can prevent bugs,
and completely eliminate some bugs. I like the way you introduce the sub-update thing. I had to look long and hard
at some of Richard Feldman's [SPA example] code to arrive to this conclusion, and spent a long time shouting WTF
while trying to understand what was going on. I would have loved to have this chapter back then...
I would definitely recommend your book. I am looking forward to the next chapters about how to use the type system."
— Christophe Graniczny
"I’m reading your Elm book and really like it — it answers several questions/problems I was facing.
Thank you for writing the book, I really appreciate it!"
— Andreas Pehnack
Feel like you're in the future of frontend development with Elm
You'll be able to glide up the learning curve and enjoy Elm's well thought out simplicity and reliability.
And as functional programming is only getting more popular, having an Elm project or two on your CV will also look good when it's time to get a promotion or switch jobs!
Buy Practical Elm
About the author
Hi, I'm Alex Korban (@alexkorban). I'm an author and software consultant with an interest in functional programming, databases, and geospatial applications.
I previously co-founded a company to help the heavy construction industry improve safety and productivity when building highways, tunnels, and other infrastructure. We did this by collecting geospatial data via mobiles and Bluetooth beacons, and then analysing and visualising it.
Prior to that I worked on a wide range of software, such as pre-iPhone mobile applications, a flight simulator, GPS-based vehicle fleet tracking, and automatic control software for construction machines (bulldozers, excavators, and self-driving kerb laying machines).
I've also written several books about C++, and a book about working with time in PostgreSQL.
What if I'm not happy with the book?
I offer a 30-day money back guarantee, so there is no risk in buying.
What format is the book in?
The book is provided in PDF format, and also EPUB and Mobi. Note, however, that EPUB and Mobi versions are formatted for tablets and provided for convenience only. I don't test them extensively, so formatting may be off - in particular, code samples may wrap awkwardly.
What version of Elm is the book written for?
Currently Elm 0.18, but I'm already working on an Elm 0.19 update, and all buyers will get this update free.
Will I get updates?
After the Elm 0.19 update is complete, I will update the book if I discover errors, and you will get those updates free.