compiler/README.md

43 lines
1.6 KiB
Markdown
Raw Normal View History

Learn about the Elm programming language at [elm-lang.org](http://elm-lang.org/).
2013-02-15 01:23:40 +04:00
2013-06-04 05:55:28 +04:00
## Install
[Please see these instructions.](https://github.com/evancz/Elm/wiki/Installing-Elm)
2012-11-03 08:08:07 +04:00
2013-06-04 06:03:54 +04:00
## Use
2012-11-03 08:08:07 +04:00
2013-06-04 05:55:28 +04:00
To use `elm` and `elm-server` you may need to add a new directory to your PATH.
2013-05-23 03:15:55 +04:00
Cabal should tell you where your executables are located upon
successful installation.
2013-05-23 03:15:55 +04: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.
2013-05-23 03:15:55 +04:00
See this tutorial if you are new to changing your PATH in
[Unix/Linux](http://www.cyberciti.biz/faq/unix-linux-adding-path/).
2013-06-04 06:03:54 +04:00
## My First Project
2012-10-27 06:06:40 +04:00
2013-05-23 03:15:55 +04:00
Now we will create a simple Elm project.
2012-11-04 12:26:45 +04:00
The following commands will set-up a very basic project and start the Elm server.
2012-04-27 02:07:45 +04:00
2012-04-28 01:54:31 +04:00
mkdir helloElm
cd helloElm
2013-06-04 06:06:54 +04:00
printf "import Mouse\n\nmain = lift asText Mouse.position" > Main.elm
2012-10-03 10:03:14 +04:00
elm-server
2012-04-27 02:07:45 +04:00
2013-06-04 06:08:23 +04:00
The first two commands create a new directory and navigate into it. The `printf`
2013-05-23 03:15:55 +04:00
commands place a simple program into `Main.elm`. Do this manually if you do not
2013-06-04 06:08:23 +04:00
have `printf`. The final command starts the Elm server at [localhost:8000](http://localhost:8000/),
2013-05-23 03:15:55 +04:00
allowing you to navigate to `Main.elm` and see your first program in action.
2012-05-31 22:18:14 +04:00
2013-10-22 15:54:53 +04:00
#### Final Notes
2013-10-22 15:54:53 +04:00
The `elm` package provides support for compilation of Elm code directly in Haskell.
Check it out [on Hackage](http://hackage.haskell.org/package/Elm) if you are interested.
2013-05-23 03:15:55 +04: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).