2013-05-24 09:45:59 +00:00
|
|
|
Learn about the Elm programming language at [elm-lang.org](http://elm-lang.org/).
|
2013-02-14 21:22:24 +00:00
|
|
|
|
2013-02-14 21:23:40 +00:00
|
|
|
|
2013-06-04 01:49:00 +00:00
|
|
|
## Installing everything on Mac OSX
|
2013-06-04 01:46:24 +00:00
|
|
|
|
|
|
|
Use [the installer](https://dl.dropboxusercontent.com/u/5850974/Elm/Elm.pkg).
|
|
|
|
|
2013-06-04 01:49:00 +00:00
|
|
|
### Installing the Compiler
|
2013-06-04 01:46:24 +00:00
|
|
|
|
2012-11-04 08:26:45 +00:00
|
|
|
Download the [Haskell Platform 2012.2.0.0](http://hackage.haskell.org/platform/).
|
2013-05-22 23:15:55 +00:00
|
|
|
Elm definitely works with GHC 7.4, so newer versions of the Haskell Platform may work too.
|
2012-11-03 04:08:07 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
Once the Haskell Platform is installed:
|
2012-11-03 04:11:01 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
cabal update ; cabal install elm
|
2012-04-26 20:08:14 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
### Installing the Server
|
2012-04-26 20:08:14 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
cabal install elm-server
|
2012-11-03 04:08:07 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
### Using the executables
|
2012-11-03 04:08:07 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
To use `elm` and `elm-server` you need to add a new directory to your PATH.
|
2012-04-26 20:08:14 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
Cabal should tell you where your executables are located upon
|
|
|
|
successful installation.
|
2012-04-26 20:08:14 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
For me, the executables were placed in `/home/evan/.cabal/bin` which I
|
|
|
|
appended to the end of my PATH variable in my .bashrc file.
|
2012-04-26 20:08:14 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
See this tutorial if you are new to changing your PATH in
|
|
|
|
[Unix/Linux](http://www.cyberciti.biz/faq/unix-linux-adding-path/).
|
2012-04-26 20:08:14 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
## A Test project
|
2012-10-27 02:06:40 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
Now we will create a simple Elm project.
|
2012-11-04 08:26:45 +00:00
|
|
|
The following commands will set-up a very basic project and start the Elm server.
|
2012-04-26 22:07:45 +00:00
|
|
|
|
2012-04-27 21:54:31 +00:00
|
|
|
mkdir helloElm
|
|
|
|
cd helloElm
|
2013-05-22 23:15:55 +00:00
|
|
|
echo import Mouse > Main.elm
|
2013-05-29 19:57:43 +00:00
|
|
|
echo main = lift asText Mouse.position >> Main.elm
|
2012-10-03 06:03:14 +00:00
|
|
|
elm-server
|
2012-04-26 22:07:45 +00:00
|
|
|
|
2012-11-04 08:26:45 +00:00
|
|
|
The first two commands create a new directory and navigate into it. The `echo`
|
2013-05-22 23:15:55 +00:00
|
|
|
commands place a simple program into `Main.elm`. Do this manually if you do not
|
|
|
|
have `echo`. The final command starts the Elm server at [localhost:8000](http://localhost:8000/),
|
|
|
|
allowing you to navigate to `Main.elm` and see your first program in action.
|
2012-05-31 18:18:14 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
#### Wrap up
|
2012-04-26 20:08:14 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
The `elm` package provides support for compilation of Elm code directly in Haskell and QuasiQuoting.
|
|
|
|
Check it out on Hackage if you are interested.
|
2012-04-28 21:12:10 +00:00
|
|
|
|
2013-05-22 23:15:55 +00:00
|
|
|
If you are stuck, email [the list](https://groups.google.com/forum/?fromgroups#!forum/elm-discuss)
|
|
|
|
or ask a question in the [#Elm IRC channel](http://webchat.freenode.net/?channels=elm).
|