elm/compiler
ngunn 175f268622 Fix cabal install missing docs.json (followup)
See: 14e32add30
for discussion on first attempt

Changed Librarys.hs and LoadLibraries.hs from TemplateHaskell to usafeIO.
Avoids needing to touch LoadLibraries after we change docs.json (as the file is loaded at runtime).
Also removes need for using CPP
Drawback of using unsafeIO is fairly well known/understood + this is a classic use-case.
Added error handling to LoadLibraries.hs

Setup.hs now uses "runProcess" instead of "system" to invoke elm compiler.
This allows us to set the environment variable "Elm_datadir" which is picked up by LoadLibraries and makes sure we get the just-built version in dist/data.
Also explicitly sets the RTS file to make sure we're not using one (as we're currently building it!)
Also change the folder the compiled JavaScript ends up in to dist/js.  Writing to the source tree, then deleting isn't very nice + this should make it easier to find elm compilation errors.  cabal clean handles the file deletion, too.

I think this fixes all the defects of the first version:
1. CPP is not needed
2. touch is not needed
3. building elm-runtime.js uses dist/data/docs.json
4. running elm after install uses the installed elm-runtime.js and docs.json
5. LoadLibraries.hs is simpler.  Doesn't use CPP or TemplateHaskell.  Has error handling and a decent error message
6. cabal clean && cabal install builds everything with the right data in the right order

(tested on ghc 7.4.1)
2013-03-22 15:52:40 +00:00
..
Gen Get sprites working in collage. temporary fix for docs.json issue. Looks like git thinks we're in the past, so a bunch of changes that have already happened as well. 2013-03-21 02:29:23 -07:00
Language Get sprites working in collage. temporary fix for docs.json issue. Looks like git thinks we're in the past, so a bunch of changes that have already happened as well. 2013-03-21 02:29:23 -07:00
Model Fix cabal install missing docs.json (followup) 2013-03-22 15:52:40 +00:00
Parse Change such that import imports all by default. Too annoying the other way. Write a linter for that. 2013-03-16 13:02:01 -07:00
Transform Finish moving the compiler down a directory. 2013-03-16 12:07:32 -07:00
Types Load json representation of types with Template Haskell, so library files are the base truth of type information. 2013-03-16 22:24:18 -07:00
Compiler.hs Move the compiler down a directory, mostly. 2013-03-16 12:04:05 -07:00
Docs.hs trivial Docs.hs (generating docs.json missing " on type line) 2013-03-21 13:27:04 +00:00
Initialize.hs Load json representation of types with Template Haskell, so library files are the base truth of type information. 2013-03-16 22:24:18 -07:00