Use Static Types
We’ve covered the first part of Elm’s defining features: functions. In this section, we will explore the second part: static types. You will learn how Elm infers static types on its own, write your own type annotations, and see Elm’s helpful compiler error messages. You will also create your first Elm file and compile it to HTML.
Create an Elm File
Up to this point, you’ve used the Elm REPL to write Elm code. The REPL is perfect for experimentation, but you’ll need Elm files to build applications. You’ll also need Elm files to add type annotations to your code. Let’s create our first Elm file as a great first step toward learning about static types.
Make a directory called elm-files. Inside that directory, run this command to ...
Get Programming Elm now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.