Fork me on GitHub

Project Notes

#290 elm

Notes

Perhaps one day elm will come with your browser, but for now there are basically three methods for installing elm:

  • binary distributions - Mac and Windows
  • nms package
  • build from source

I’ll try my first tests using npm.

Installing with npm

For routing use, it is recommended to install elm globally:

npm install -g elm

For a first test though, I’m going to install locally - even though elm does warn not to!

Initial package.json setup

npm init
npm install elm --save-dev

Install from package.json

npm install

Put the local node_packages bin directory on the path. Hopefully this should get around any problems with this not being a global install:

export PATH=$(npm bin):$PATH

So far so good:

$ elm
Elm Platform 0.16.0 - a way to run all Elm tools

Usage: elm <command> [<args>]

Available commands include:

make      Compile an Elm file or project into JS or HTML
package   Manage packages from <http://package.elm-lang.org>
reactor   Develop with compile-on-refresh and time-travel debugging
repl      A REPL for running individual expressions

You can learn more about a specific command by running things like:

elm make --help
elm package --help
elm <command> --help

In all these cases we are simply running 'elm-<command>' so if you create an
executable named 'elm-foobar' you will be able to run it as 'elm foobar' as
long as it appears on your PATH.

Quick REPL Test

Elm has a REPL package for testing snippets interactively.

$ elm repl
---- elm repl 0.16.0 -----------------------------------------------------------
:help for help, :exit to exit, more at <https://github.com/elm-lang/elm-repl>
--------------------------------------------------------------------------------
> 1 + 1
2 : number
> f n = n + 1
<function> : number -> number
> f 41
42 : number
> :exit

Going Global

OK, now that seems to be all working OK, I went ahead and installed globally:

npm install -g elm

Credits and References

About LCK#290 ElmMacOS
Project Source on GitHub Return to the Project Catalog

LittleCodingKata is my collection of programming exercises, research and code toys broadly spanning things that relate to programming and software development (languages, frameworks and tools).

These range from the trivial to the complex and serious. Many are inspired by existing work and I'll note credits and references where applicable. The focus is quite scattered, as I variously work on things new and important in the moment, or go back to revisit things from the past.

This is primarily a personal collection for my own edification and learning, but anyone who stumbles by is welcome to borrow, steal or reference the work here. And if you spot errors or issues I'd really appreciate some feedback - create an issue, send me an email or even send a pull-request.

LittleArduinoProjects LittleModelArt More on my blog