elm-repl 0.4 → 0.4.1
raw patch · 6 files changed
+17/−13 lines, 6 filesdep ~elm-compiler
Dependency ranges changed: elm-compiler
Files
- elm-repl.cabal +3/−3
- src/Eval/Code.hs +3/−3
- src/Eval/Command.hs +2/−2
- src/Flags.hs +3/−1
- src/Main.hs +5/−3
- tests/Main.hs +1/−1
elm-repl.cabal view
@@ -1,5 +1,5 @@ Name: elm-repl-Version: 0.4+Version: 0.4.1 Synopsis: a REPL for Elm@@ -60,7 +60,7 @@ cmdargs >= 0.7 && < 0.11, containers, directory >= 1 && < 2,- elm-compiler >= 0.14 && < 0.15,+ elm-compiler >= 0.15 && < 0.16, elm-package, filepath >= 1 && < 2, haskeline >= 0.7 && < 0.8,@@ -93,7 +93,7 @@ bytestring-trie >= 0.2.2 && < 0.3, cmdargs >= 0.7 && < 0.11, directory >= 1 && < 2,- elm-compiler >= 0.14 && < 0.15,+ elm-compiler >= 0.15 && < 0.16, elm-package, filepath >= 1 && < 2, haskeline >= 0.7 && < 0.8,
src/Eval/Code.hs view
@@ -28,7 +28,7 @@ eval :: (Maybe Input.DefName, String) -> Eval.Command () eval code =- do modify $ Env.insert code + do modify $ Env.insert code env <- get liftIO $ writeFile tempElmPath (Env.toElmCode env) liftIO . runConts $ do@@ -41,13 +41,13 @@ return () where runConts m = runContT m (\_ -> return ())- + tempElmPath = "repl-temp-000" <.> "elm" tempJsPath = replaceExtension tempElmPath "js"- + elmArgs = [ tempElmPath , "--yes"
src/Eval/Command.hs view
@@ -13,10 +13,10 @@ -} type Command =- RWST Flags.Flags () Env.Env IO+ RWST Flags.Flags () Env.Env IO run :: Flags.Flags -> Env.Env -> Command a -> IO a run flags env command = do (x,_,_) <- runRWST command flags env- return x+ return x
src/Flags.hs view
@@ -8,7 +8,9 @@ , name, summary, typFile, versionArg ) +import qualified Elm.Compiler as Compiler + version = showVersion This.version @@ -34,7 +36,7 @@ &= versionArg [explicit, name "version", name "v", summary version] - &= summary ("Elm REPL " ++ version ++ ", (c) Evan Czaplicki 2011-2014")+ &= summary ("Elm REPL " ++ version ++ " (Elm Platform " ++ Compiler.version ++ ")") helpMessage :: String
src/Main.hs view
@@ -12,6 +12,7 @@ import qualified Eval.Command as Eval import qualified Flags import qualified Loop+import qualified Elm.Compiler as Compiler main :: IO ()@@ -19,7 +20,7 @@ do flags <- CmdArgs.cmdArgs Flags.flags stuffExisted <- Dir.doesDirectoryExist "elm-stuff" pkgJsonExisted <- Dir.doesFileExist "elm-package.json"- settings <- mkSettings+ settings <- mkSettings putStrLn welcomeMessage exitCode <- ifJsInterpExists flags (Loop.loop flags settings) when (not stuffExisted) (removeDirectoryRecursiveIfExists "elm-stuff")@@ -31,8 +32,9 @@ welcomeMessage :: String welcomeMessage =- "Elm REPL " ++ Flags.version ++ " <https://github.com/elm-lang/elm-repl#elm-repl>\n\- \Type :help for help, :exit to exit"+ "Elm REPL " ++ Flags.version ++ " (Elm Platform " ++ Compiler.version ++ ")\n\+ \ See usage examples at <https://github.com/elm-lang/elm-repl>\n\+ \ Type :help for help, :exit to exit" getDataDir :: IO FilePath
tests/Main.hs view
@@ -64,7 +64,7 @@ codeParseTests = [ testCase "number parses" $ codeParses Nothing "3" , testCase "number parses after newlines" $ codeParses Nothing "\n\n3"- , testCase "data def parses" $ codeParses (Just $ I.DataDef "Baz") "data Baz = B { }"+ , testCase "data def parses" $ codeParses (Just $ I.DataDef "Baz") "type Baz = B { }" , testCase "var def parses" $ codeParses (Just $ I.VarDef "x") "x = 3" , testCase "var fun def parses" $ codeParses (Just $ I.VarDef "f") "f x = x" ]