git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Don't special case `let` in the commands.
7c19115joneshf
psci/Commands.hs−2
@@ -8,7 +8,6 @@ data Command
8 | Expression [String]
8 | Expression [String]
9 | Help
9 | Help
10 | Import String
10 | Import String
11− | Let String
12 | LoadFile FilePath
11 | LoadFile FilePath
13 | Quit
12 | Quit
14 | Reload
13 | Reload
@@ -25,7 +24,6 @@ getCommand = do
25 Just ":q" -> return Quit
24 Just ":q" -> return Quit
26 Just ":r" -> return Reload
25 Just ":r" -> return Reload
27 Just (':':_) -> return Unknown
26 Just (':':_) -> return Unknown
28− Just l@('l':'e':'t':_) -> return $ Let l
29 Just other -> Expression <$> go [other]
27 Just other -> Expression <$> go [other]
30 where
28 where
31 go ls = do
29 go ls = do
psci/Main.hs+1−5
@@ -164,7 +164,7 @@ parseExpression = P.whiteSpace *> P.parseValue <* Parsec.eof
164handleCommand :: Command -> StateT PSCI (InputT IO) ()
164handleCommand :: Command -> StateT PSCI (InputT IO) ()
165handleCommand Empty = return ()
165handleCommand Empty = return ()
166handleCommand (Expression ls) =
166handleCommand (Expression ls) =
167− case P.runIndentParser "" parseDoNotationBind (unlines ls) of
167+ case P.runIndentParser "" parseDoNotationLet (unlines ls) of
168 Left _ ->
168 Left _ ->
169 case P.runIndentParser "" parseExpression (unlines ls) of
169 case P.runIndentParser "" parseExpression (unlines ls) of
170 Left err -> inputTToState $ outputStrLn (show err)
170 Left err -> inputTToState $ outputStrLn (show err)
@@ -172,10 +172,6 @@ handleCommand (Expression ls) =
172 Right binder -> modify (updateBinders binder)
172 Right binder -> modify (updateBinders binder)
173handleCommand Help = inputTToState $ outputStrLn helpMessage
173handleCommand Help = inputTToState $ outputStrLn helpMessage
174handleCommand (Import moduleName) = modify (updateImports moduleName)
174handleCommand (Import moduleName) = modify (updateImports moduleName)
175−handleCommand (Let line) =
176− case P.runIndentParser "" parseDoNotationLet line of
177− Left err -> inputTToState $ outputStrLn (show err)
178− Right binder -> modify (updateBinders binder)
179handleCommand (LoadFile filePath) = do
175handleCommand (LoadFile filePath) = do
180 mf <- ioToState $ loadModule filePath
176 mf <- ioToState $ loadModule filePath
181 case mf of
177 case mf of