on 8f7c3cd help sign in
elk/cli/src/Develop/Compile.hs
30 lines 689 B history raw
1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Develop.Compile
4 ( toJavaScript
5 )
6 where
9import qualified Data.ByteString.Char8 as BS
13-- TO JAVASCRIPT
16toJavaScript :: FilePath -> IO BS.ByteString
17toJavaScript filePath =
18 do result <- error "TODO toJavaScript" filePath
19 case result of
20 Right (code, name) ->
21 return $ BS.append code $ BS.pack $
22 "var runElmProgram = Elm." ++ name ++ ".fullscreen;"
24 Left errMsg ->
25 return $ BS.concat $
26 [ BS.pack $ "function runElmProgram() {\n\tElm.Errors.fullscreen("
27 , error "TODO show compile issues" errMsg
28 , ");\n}"
29 ]