No description
Find a file
Justin Leitgeb 952c02fabf Improve error messages when elm input file or binary can't be found
There are a few problems currently with the elm server:

  1. When the elm binary is not found, a nondescript error is displayed
  2. When a file has a suffix .elm but the file is not found, the same error
     as in (1) is displayed
  3. When a non-existing file ending in .elm is requested, the error code is
     incorrect - the elm-server returns a 400 instead of a 404

The following is the error message that shows up in cases (1) and (2) above:

    Server error: elm-server-cache: getDirectoryContents: does not exist (No such file or directory)

This commit fixes the generic runtime errors (source of (1) and (2) above) by
guarding against trying to delete a non-existing directory. It also fixes the
HTTP code for non-existing .elm files by returning the general Happstack 404
page that is returned for other not-found requests.
2013-10-11 20:44:29 -04:00
compiler Relax mtime test in alreadyCompiled 2013-10-09 13:10:35 +02:00
libraries cosmetic: fix typo and remove redundancy 2013-10-08 20:06:26 -07:00
runtime New convention for storing module values, fixes bug 2013-09-30 01:32:27 -07:00
server Improve error messages when elm input file or binary can't be found 2013-10-11 20:44:29 -04:00
tests Add occurs check and a test to make sure it works 2013-08-19 22:39:41 -07:00
.gitignore add the new data dir to ignore 2013-08-09 23:39:34 -07:00
changelog.txt Update change log 2013-09-02 16:37:24 -07:00
Contributor Agreement.docx Add the contributor agreement. 2013-06-03 15:09:44 -07:00
Elm.cabal Remove minification from compiler. 2013-09-28 15:36:02 -04:00
LICENSE It's 2013 everyone! 2013-09-13 12:09:10 -07:00
README.md Pull the Mac installer until it is updated to 0.9 2013-08-09 23:21:42 -07:00
Setup.hs Fix cabal configure in Cabal version 1.18. 2013-09-21 16:52:01 -05:00

Learn about the Elm programming language at elm-lang.org.

Install

Download the Haskell Platform 2012.2.0.0. Elm definitely works with GHC 7.4, so newer versions of the Haskell Platform may work too. Once the Haskell Platform is installed:

cabal update
cabal install elm
cabal install elm-server

Use

To use elm and elm-server you may need to add a new directory to your PATH.

Cabal should tell you where your executables are located upon successful installation.

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.

See this tutorial if you are new to changing your PATH in Unix/Linux.

My First Project

Now we will create a simple Elm project. The following commands will set-up a very basic project and start the Elm server.

mkdir helloElm
cd helloElm
printf "import Mouse\n\nmain = lift asText Mouse.position" > Main.elm
elm-server

The first two commands create a new directory and navigate into it. The printf commands place a simple program into Main.elm. Do this manually if you do not have printf. The final command starts the Elm server at localhost:8000, allowing you to navigate to Main.elm and see your first program in action.

Wrap up

The elm package provides support for compilation of Elm code directly in Haskell and QuasiQuoting. Check it out on Hackage if you are interested.

If you are stuck, email the list or ask a question in the #Elm IRC channel.