git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Evaluate after let declaration
2e55e86Gary Burgess
psci/Main.hs+5−2
@@ -56,6 +56,7 @@ import qualified System.IO.UTF8 as U
56 (writeFile, putStrLn, print, readFile)
56 (writeFile, putStrLn, print, readFile)
57import qualified Language.PureScript.Names as N
57import qualified Language.PureScript.Names as N
58import qualified Language.PureScript.Declarations as D
58import qualified Language.PureScript.Declarations as D
59+import qualified Language.PureScript.Constants as C
59
60
60-- |
61-- |
61-- The PSCI state.
62-- The PSCI state.
@@ -132,7 +133,7 @@ loadModule filename = either (Left . show) Right . P.runIndentParser filename P.
132--
133--
133loadAllModules :: [FilePath] -> IO (Either ParseError [(Either P.RebuildPolicy FilePath, P.Module)])
134loadAllModules :: [FilePath] -> IO (Either ParseError [(Either P.RebuildPolicy FilePath, P.Module)])
134loadAllModules files = do
135loadAllModules files = do
135− filesAndContent <- forM files $ \filename -> do
136+ filesAndContent <- forM files $ \filename -> do
136 content <- U.readFile filename
137 content <- U.readFile filename
137 return (Right filename, content)
138 return (Right filename, content)
138 return $ P.parseModulesFromFiles (either (const "") id) $ (Left P.RebuildNever, P.prelude) : filesAndContent
139 return $ P.parseModulesFromFiles (either (const "") id) $ (Left P.RebuildNever, P.prelude) : filesAndContent
@@ -444,7 +445,9 @@ handleCommand :: Command -> PSCI ()
444handleCommand (Expression val) = handleDeclaration val
445handleCommand (Expression val) = handleDeclaration val
445handleCommand Help = PSCI $ outputStrLn helpMessage
446handleCommand Help = PSCI $ outputStrLn helpMessage
446handleCommand (Import moduleName) = handleImport moduleName
447handleCommand (Import moduleName) = handleImport moduleName
448+handleCommand (Let l) = do
447−handleCommand (Let l) = PSCI $ lift $ modify (updateLets l)
449+ PSCI $ lift $ modify (updateLets l)
450+ handleDeclaration (D.Var (N.Qualified (Just $ N.ModuleName [N.ProperName C.prelude]) (N.Ident C.unit)))
448handleCommand (LoadFile filePath) = do
451handleCommand (LoadFile filePath) = do
449 absPath <- psciIO $ expandTilde filePath
452 absPath <- psciIO $ expandTilde filePath
450 exists <- psciIO $ doesFileExist absPath
453 exists <- psciIO $ doesFileExist absPath
src/Language/PureScript/Constants.hs+3
@@ -153,6 +153,9 @@ mkFn = "mkFn"
153runFn :: String
153runFn :: String
154runFn = "runFn"
154runFn = "runFn"
155
155
156+unit :: String
157+unit = "unit"
158+
156-- Prim values
159-- Prim values
157
160
158undefined :: String
161undefined :: String