on master help sign in
Make changes to get elm-reactor working
db0f872Evan Czaplicki
elm-compiler.cabal+1
@@ -29,6 +29,7 @@ Build-type: Simple
29
29
30Data-files:
30Data-files:
31 runtime/core.js
31 runtime/core.js
32+ runtime/debug.js
32
33
33source-repository head
34source-repository head
34 type: git
35 type: git
runtime/core.js+3−3
@@ -1,5 +1,5 @@
1
1
2−var Elm = {
2+var Elm = Elm || {
3 Native: {}
3 Native: {}
4};
4};
5
5
@@ -281,7 +281,7 @@ function initGraphics(elm, Module) {
281 var signalGraph = Module.main;
281 var signalGraph = Module.main;
282
282
283 // make sure the signal graph is actually a signal & extract the visual model
283 // make sure the signal graph is actually a signal & extract the visual model
284− var Signal = Elm.Native.Signal.make(elm);
284+ var Signal = Elm.Signal.make(elm);
285 if (!('recv' in signalGraph)) {
285 if (!('recv' in signalGraph)) {
286 signalGraph = Signal.constant(signalGraph);
286 signalGraph = Signal.constant(signalGraph);
287 }
287 }
@@ -301,7 +301,7 @@ function initGraphics(elm, Module) {
301 savedScene = newScene;
301 savedScene = newScene;
302 });
302 });
303 }
303 }
304− var renderer = A2(Signal.lift, domUpdate, signalGraph);
304+ var renderer = A2(Signal.map, domUpdate, signalGraph);
305
305
306 // must check for resize after 'renderer' is created so
306 // must check for resize after 'renderer' is created so
307 // that changes show up.
307 // that changes show up.
runtime/debug.js+5−5
@@ -8,18 +8,18 @@ if (typeof window != 'undefined' && !window.location.origin) {
8 (window.location.port ? (':' + window.location.port) : '');
8 (window.location.port ? (':' + window.location.port) : '');
9}
9}
10
10
11−Elm.fullscreenDebugHooks = function(module, debuggerHistory /* =undefined */) {
11+Elm.fullscreenDebugHooks = function(elmModule, debuggerHistory /* =undefined */) {
12 var exposedDebugger = {};
12 var exposedDebugger = {};
13− function debuggerAttach(module, debuggerHistory) {
13+ function debuggerAttach(elmModule, debuggerHistory) {
14 return {
14 return {
15 make: function(runtime) {
15 make: function(runtime) {
16− var wrappedModule = debugModule(module, runtime);
16+ var wrappedModule = debugModule(elmModule, runtime);
17 exposedDebugger = debuggerInit(wrappedModule, runtime, debuggerHistory);
17 exposedDebugger = debuggerInit(wrappedModule, runtime, debuggerHistory);
18 return wrappedModule.debuggedModule;
18 return wrappedModule.debuggedModule;
19 }
19 }
20 }
20 }
21 }
21 }
22− var mainHandle = Elm.fullscreen(debuggerAttach(module, debuggerHistory));
22+ var mainHandle = Elm.fullscreen(debuggerAttach(elmModule, debuggerHistory));
23 mainHandle.debugger = exposedDebugger;
23 mainHandle.debugger = exposedDebugger;
24 return mainHandle;
24 return mainHandle;
25};
25};
@@ -419,7 +419,7 @@ function Point(x, y) {
419function tracePathInit(runtime, signalGraphMain) {
419function tracePathInit(runtime, signalGraphMain) {
420 var List = Elm.List.make(runtime);
420 var List = Elm.List.make(runtime);
421 var Signal = Elm.Signal.make(runtime);
421 var Signal = Elm.Signal.make(runtime);
422− var tracePathNode = A2(Signal.lift, graphicsUpdate, signalGraphMain);
422+ var tracePathNode = A2(Signal.map, graphicsUpdate, signalGraphMain);
423 var tracePathCanvas = createCanvas();
423 var tracePathCanvas = createCanvas();
424 var tracePositions = {};
424 var tracePositions = {};
425 var recordingTraces = true;
425 var recordingTraces = true;
src/Elm/Compiler.hs+12−1
@@ -1,6 +1,10 @@
1{-# OPTIONS_GHC -Wall #-}
1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE FlexibleContexts #-}
2{-# LANGUAGE FlexibleContexts #-}
3+module Elm.Compiler
4+ ( version
3−module Elm.Compiler (version, parseDependencies, compile, runtimePath) where
5+ , parseDependencies, compile
6+ , runtimePath, runtimeDebugPath
7+ ) where
4
8
5import Control.Monad.Error (MonadError, throwError)
9import Control.Monad.Error (MonadError, throwError)
6import qualified Data.List as List
10import qualified Data.List as List
@@ -75,3 +79,10 @@ compile user packageName source interfaces =
75runtimePath :: IO FilePath
79runtimePath :: IO FilePath
76runtimePath =
80runtimePath =
77 Utils.getAsset "compiler" Paths.getDataFileName "runtime/core.js"
81 Utils.getAsset "compiler" Paths.getDataFileName "runtime/core.js"
82+
83+
84+{-| Path to the debugger runtime.
85+-}
86+runtimeDebugPath :: IO FilePath
87+runtimeDebugPath =
88+ Utils.getAsset "compiler" Paths.getDataFileName "runtime/debug.js"