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
|
|
|
|
2014-01-17 19:48:29 +00:00
|
|
|
[![Build Status](https://travis-ci.org/evancz/Elm.png)](https://travis-ci.org/evancz/Elm)
|
|
|
|
|
2013-06-04 01:55:28 +00:00
|
|
|
## Install
|
|
|
|
|
2013-12-19 22:14:17 +00:00
|
|
|
**Arch Linux** — follow [these directions](https://github.com/evancz/Elm/wiki/Installing-Elm#arch-linux) and then
|
2013-12-19 22:08:39 +00:00
|
|
|
jump to the [My First Project](#my-first-project) section.
|
2013-12-19 22:14:17 +00:00
|
|
|
<br/>
|
2014-01-21 12:51:19 +00:00
|
|
|
**OS X 10.9 or XCode 5** — follow
|
2013-12-19 22:08:39 +00:00
|
|
|
[these directions](http://justtesting.org/post/64947952690/the-glasgow-haskell-compiler-ghc-on-os-x-10-9)
|
2013-12-19 22:14:17 +00:00
|
|
|
before continuing with the platform agnostic directions below.
|
2013-12-19 22:04:03 +00:00
|
|
|
|
2013-12-20 18:07:52 +00:00
|
|
|
**Platform Agnostic** —
|
2013-12-19 22:14:17 +00:00
|
|
|
download the [Haskell Platform 2012.2.0.0 or later](http://hackage.haskell.org/platform/).
|
2013-12-19 22:09:49 +00:00
|
|
|
Once the Haskell Platform is installed:
|
2013-12-19 22:04:03 +00:00
|
|
|
|
2013-12-19 22:05:52 +00:00
|
|
|
cabal update
|
|
|
|
cabal install elm
|
|
|
|
cabal install elm-server
|
2012-11-03 04:08:07 +00:00
|
|
|
|
2013-06-04 02:03:54 +00:00
|
|
|
## Use
|
2012-11-03 04:08:07 +00:00
|
|
|
|
2013-06-04 01:55:28 +00:00
|
|
|
To use `elm` and `elm-server` you may 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
|
2013-12-19 22:04:03 +00:00
|
|
|
successful installation. It'll be something like `/home/evan/.cabal/bin`
|
|
|
|
which you should append to your PATH variable.
|
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-06-04 02:03:54 +00:00
|
|
|
## My First 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-06-04 02:06:54 +00:00
|
|
|
printf "import Mouse\n\nmain = lift asText Mouse.position" > Main.elm
|
2012-10-03 06:03:14 +00:00
|
|
|
elm-server
|
2012-04-26 22:07:45 +00:00
|
|
|
|
2013-06-04 02:08:23 +00:00
|
|
|
The first two commands create a new directory and navigate into it. The `printf`
|
2013-05-22 23:15:55 +00:00
|
|
|
commands place a simple program into `Main.elm`. Do this manually if you do not
|
2013-06-04 02:08:23 +00:00
|
|
|
have `printf`. The final command starts the Elm server at [localhost:8000](http://localhost:8000/),
|
2013-05-22 23:15:55 +00:00
|
|
|
allowing you to navigate to `Main.elm` and see your first program in action.
|
2012-05-31 18:18:14 +00:00
|
|
|
|
2013-10-22 11:54:53 +00:00
|
|
|
#### Final Notes
|
2012-04-26 20:08:14 +00:00
|
|
|
|
2013-12-30 23:57:42 +00:00
|
|
|
The `elm` package provides
|
|
|
|
[some utility functions](http://hackage.haskell.org/package/Elm) for
|
|
|
|
working with Elm in Haskell. This can be useful for creating tooling
|
|
|
|
for Elm, and has been useful for projects like
|
|
|
|
[the website](http://elm-lang.org/) and
|
|
|
|
[`elm-get`](https://github.com/evancz/elm-get). Email the list if you
|
|
|
|
want to rely on these functions!
|
|
|
|
|
|
|
|
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).
|