@@ -5,8 +5,8 @@ import Happstack.Server
55import Language.Elm
66import Language.Elm.Quasi
77
8−elmLoc :: String
9−elmLoc = "https://raw.github.com/evancz/Elm/master/elm/elm-runtime-0.7.1.1.js"
8+elmRuntime="elm-runtime.js"
9+elmRTPath='/':elmRuntime
1010
1111-- elmResponse is a "nice to have" helper function for compiling
1212-- Elm code when using Elm with Happstack. At some point this might
@@ -15,7 +15,7 @@ elmResponse :: ElmSource a
1515 => String -- ^ Page title
1616 -> a -- ^ elm source
1717 -> Response
18−elmResponse title = toResponse . toHtml elmLoc title
18+elmResponse title = toResponse . toHtml elmRTPath title
1919
2020-- embedding variables (in this case URLs)
2121rootHandler :: ServerPart Response
@@ -52,11 +52,13 @@ shapesHandler :: ServerPart Response
5252shapesHandler = ok $ elmResponse "Simple shapes" $ shapesPage
5353
5454-- routing
55−elmExample :: ServerPart Response
56−elmExample =
57− msum [ nullDir >> rootHandler
55+elmExample :: String -> ServerPart Response
56+elmExample elmLoc = do
57+ msum [ nullDir >> rootHandler
58+ , dir elmRuntime $ nullDir >>
59+ serveFile (guessContentTypeM mimeTypes) elmLoc
5860 , dir "mouse" $ nullDir >>
59− mouseHandler
61+ mouseHandler
6062 , dir "clock" $ nullDir >>
6163 clockHandler
6264 , dir "shapes" $ nullDir >>
@@ -64,4 +66,6 @@ elmExample =
6466 ]
6567
6668main :: IO ()
67−main = simpleHTTP nullConf {port = 3000} elmExample
69+main = do
70+ elmLoc <- Language.Elm.runtimeLocation
71+ simpleHTTP nullConf {port = 3000} $ elmExample elmLoc