Hi there! Thanks for stopping by. I hope you will find this book helpful for learning Elm — a delightful programming language for building robust front-end web applications.
I first discovered Elm when I listened to a Functional Geekery podcast episode featuring Richard Feldman and Tessa Kelly. When I heard Tessa mention that it’s almost impossible to have runtime errors in Elm, I was intrigued. None of the languages I have worked with during my fifteen years as a programmer offered such a guarantee, so I started experimenting with Elm. To my delight, I not only found Tessa’s claim to be true, but also really enjoyed writing code in Elm.
Although it’s been more than seven years since Elm was created, it hadn’t caught most front-end web developers’ attention until recently. More and more programmers are experimenting with the language and using it in production. They are also sharing what they have learned with the ever-growing community.
I, too, am constantly learning new things about Elm on a daily basis. This book is an attempt to distill my understanding of Elm thus far. I will continue to update the material in this book as I gain more insight into the language and Elm ecosystem in general.
With that, I would like to invite you to join me on a wonderful journey into learning a very friendly yet extremely practical language.
This book assumes you have a basic understanding of programming, but no prior knowledge of Elm or functional programming is required. Nor do you need any mathematical background. If you have dabbled in a programming language before, you should have no trouble learning Elm with this book.
Contents:
Introduction - Get your feet wet with Elm 1 01 Introduction 2 Why Elm? 3 Feedback 4 Who This Book is For 5 Conventions Used in This Book 6 Acknowledgements 7 About the Author 8
02 Getting Started 9 Installation 10 Building a Simple Web Page 11 Elm Platform 12 Elm Programming Language 13 Elm Compiler 14 Elm Architecture 15 Elm Runtime 16 elm make 17 elm install 18 elm reactor 19 elm repl 20 Ellie 21 Conclusion 22
Syntax & Semantics - Learn Elm from the ground up 23 03 Elm Language Basics 24 Simple Arithmetic 25 Boolean 26 Comparison 27 Comments 28 Expression 29 Value 30 Constant 31 If Expression 32 Function 33 Let Expression 34 Case Expression 35 Indentation 36 String 37 Regular Expression 38 List 39 Array 40 Tuple 41 Record 42 Conclusion 43
04 Benefits of Using Elm 44 Immutability 45 Pure Functions 46 Solving Complex Problems with Simple Functions 47 Easy to Test 48 Type System 49 Easier Code Organization 50 Fuzz Testing 51 Pattern Matching 52 Conclusion 53
Architecture - Understand how the Elm Architecture helps us build robust front-end web applications 54 05 Elm Architecture 55 Model View Update - Part 1 56 Virtual DOM 57 Model View Update - Part 2 58 Side Effects 59 Commands 60 Conclusion 61
06 HTTP Requests 62 Fetching Data Using GET 63 Decoding JSON - Part 1 64 Decoding JSON - Part 2 65 RemoteData 66 Retrieving Data on Initialization 67 Conclusion 68
07 Single-Page Apps 69 What is a Single-Page App? 70 Restructuring Code 71 Creating Post Module 72 Creating List Posts Page 73 Navigating to List Posts Page 74 Editing a Post 75 Deleting a Post 76 Creating a New Post 77 Conclusion 78
08 Interact with JavaScript 79 Sending Data to JavaScript 80 Subscriptions 81 Receiving Data from JavaScript 82 Protecting Boundaries between Elm and JavaScript 83 Saving App State in Local Storage 84 Retrieving App State from Local Storage 85 Interacting with Web Components 86 Conclusion 87 Where To Go From Here? 88
About the Autor: Hi there, my name is Pawan Poudel. I have been programming for more than fifteen years. My first encounter with programming was with GW-BASIC when I was in eighth grade. However, it wasn’t until I discovered C in college that I really started to enjoy programming. Since then, I have programmed in C++, Java, C#, Objective-C, Swift, Python, Ruby, and JavaScript.
Before moving into web development, I spent more than five years honing my mobile development skills building iOS apps. Lately, I have been spending most of my free time learning functional programming languages, mainly Elm and Haskell.
I believe programming is an art and a science. Therefore, I have deep respect f...
The author gives very clear and detailed explanations. I like that he repeats some of them multiple times, as sometimes it's not that simple to grasp the whole picture immediately. Interesting examples are another positive side. They are not stopped on simple `Int` and `String`, so we can find many real-life scenarios. I got lost on few places, but that's on me for not trying the code myself. I will definitely return to this book again.