elm-lang/Elm — pull request #817 by JoeyEremondi (2014-10-19 15:11:06+00:00)
Title: Implemented multi-file compiling as a library function

I've implemented a function that can compile multiple modules. It will make Elm much easier to use as a library, which will be ideal for using elm with web-frameworks. Also, if we every try to make a web IDE, something similar to FP-haskell centre, then this will be very useful.

I'm writing this with Haskelm in mind, but I can think of a lot of other uses for it.

I wasn't sure how to test it using the test-suite, but I've pasted output from a basic cabal-repl test below.
```
Prelude Elm.Internal.Dependencies> import Elm.Internal.Utils

Prelude Elm.Internal.Utils Elm.Internal.Dependencies> let s1 = "module Foo where
\nbar = 3"
Prelude Elm.Internal.Utils Elm.Internal.Dependencies> let s2 = "module Main wher
e\nimport Json\nimport Foo\nx = Json.fromString\n\ns = Foo.bar\nmain = asText 3"

Prelude Elm.Internal.Utils Elm.Internal.Dependencies> compileInOrder [s1, s2]
Right "Elm.Main = Elm.Main || {};\nElm.Main.make = function (_elm) {\n \"use s
trict\";\n _elm.Main = _elm.Main || {};\n if (_elm.Main.values)\n return _
elm.Main.values;\n var _op = {},\n _N = Elm.Native,\n _U = _N.Utils.make(_
elm),\n _L = _N.List.make(_elm),\n _A = _N.Array.make(_elm),\n _E = _N.Err
or.make(_elm),\n $moduleName = \"Main\",\n $Foo = Elm.Foo.make(_elm),\n $J
son = Elm.Json.make(_elm),\n $Text = Elm.Text.make(_elm);\n var main = $Text
.asText(3);\n var s = $Foo.bar;\n var x = $Json.fromString;\n _elm.Main.va
lues = {_op: _op\n ,x: x\n ,s: s\n
,main: main};\n return _elm.Main.values;\n};"
```