CompileToJS generates objects using "ctor:"... for all non-primitives.
Added special handling for lists
Might be better to have a separate tag instead of: Data "Nil"
Test case:
main_join = let f x xs = (x::xs)
in asText $ zipWith f ['c','m','t'] ["hop","ill","ape"]
before fails with "xs: undefined".
put foldl back as was + add type sig. to indicate why
replace use of xs.ctor with direct comparison against Nil. This means the ctor field is no longer required (which is nice).
move .ctor in stor to the actual variable (doh)
freeze Nil (one-time overhead for marginal safety)
don't do this for Cons (huge performance overhead)
use Nil throughout instead of making our own (if we're having a singleton, we should be consistently using it)
missing A2, A3 in places.
foldl function applied args in wrong order, foldl :: (a -> b -> a) -> a -> [b] -> a
sort: missing .ctor selector
- Copy documentation from elm-lang.org (dev branch) to .elm files in
libraries folder
- Added TODO's for stuff that was not found in 0.8 version
- Added Review TODO in json.elm
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)