O'Reilly logo

Programming Elm by Jeremy Fairbank

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required