The Pragmatic Studio

Hello, Elm!

Notes

Default Module Declaration

If you forget to add a module declaration at the top of an Elm file, Elm will put everything in a Main module like so:

module Main exposing (..)

Installing Project Dependencies

In an empty project directory, running elm package install generates a new elm-package.json file and adds dependencies for the elm-lang/core, elm-lang/html, and elm-lang/virtual-dom packages.

However, if an elm-package.json file already exists in a project directory, then running elm package install will install all the package dependencies listed in that elm-package.json file. That means you can download an Elm project and run elm package install to install all the dependencies of that project in one fell swoop!

To install a specific package, specify the package name like so:

elm-package install elm-lang/html

That downloads the latest version of the elm-lang package that's compatible with the installed version of Elm. And the elm-package.json file is automatically updated to include the new package dependency.

To install a specific version of a package, include the version number like so:

elm-package install elm-lang/html 3.0.0

Reactor Options

By default, the Elm reactor fires up on localhost port 8000. You can change the address and/or port by specifying --address and --port options. For example, here's how to run on the 0.0.0.0 address using port 9000:

elm reactor --address=0.0.0.0 --port=9000

Code So Far

The code for this video is in the hello-elm directory found within the video-code directory of the code bundle.

All course material, including videos and source code, is copyrighted and licensed for individual use only. You may make copies for your own personal use (e.g. on your laptop, on your iPad, on your backup drive). However, you may not transfer ownership or share the material with other people. We make no guarantees that the source code is fit for any purpose. Course material may not be used to create training material, courses, books, and the like. Please support us by encouraging others to purchase their own copies. Thank you!

Copyright © 2005–2024, The Pragmatic Studio. All Rights Reserved.