9ae1825939
We previously had to fix a corrupt Map by changing it to a List and then back into a Map. It turns out we had to do this because the original data structure on disk wasn't a Map to begin with, but a List. It was previously assumed to be a Map by the compiler because the first function that it was passed to took a type of `Interfaces` which is a Map of interface definitions. Unfortunately this didn't cause a runtime error when Haskell found out that the structure wasn't deserialized into a Map. Instead Haskell happily created a broken Map that couldn't find members some of the members that it contained (it could find somewhere around the first half of its members, but the second half it reported as missing when they were clearly present). Changing the type of the first function that the deserialized structure is passed to from a Map (actually Interfaces which is a type of Map) to a List allows Haskell to infer the correct type to deserialize into and makes everything work as expected. |
||
---|---|---|
compiler | ||
libraries | ||
runtime | ||
server | ||
tests | ||
.gitignore | ||
changelog.txt | ||
Contributor Agreement.docx | ||
Elm.cabal | ||
LICENSE | ||
README.md | ||
Setup.hs |
Learn about the Elm programming language at elm-lang.org.
Install
Download the Haskell Platform 2012.2.0.0 or later. 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.
Final Notes
The elm
package provides support for compilation of Elm code directly in Haskell.
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.