git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Evaluate after let declaration

Resolves #615

commit2e55e86ec38df7f038be1614f7cc3129a6c25e18 authorGary Burgess <gary.burgess@gmail.com> dateSat 15 Nov 2014, 14:13 (12 years ago) parentdfd8ae6
2 files changed+8−2
psci/Main.hs+5−2 src/Language/PureScript/Constants.hs+3
psci/Main.hs+5−2
@@ -56,6 +56,7 @@ import qualified System.IO.UTF8 as U
5656 (writeFile, putStrLn, print, readFile)
5757import qualified Language.PureScript.Names as N
5858import qualified Language.PureScript.Declarations as D
59+import qualified Language.PureScript.Constants as C
5960
6061-- |
6162-- The PSCI state.
@@ -132,7 +133,7 @@ loadModule filename = either (Left . show) Right . P.runIndentParser filename P.
132133--
133134loadAllModules :: [FilePath] -> IO (Either ParseError [(Either P.RebuildPolicy FilePath, P.Module)])
134135loadAllModules files = do
135− filesAndContent <- forM files $ \filename -> do
136+ filesAndContent <- forM files $ \filename -> do
136137 content <- U.readFile filename
137138 return (Right filename, content)
138139 return $ P.parseModulesFromFiles (either (const "") id) $ (Left P.RebuildNever, P.prelude) : filesAndContent
@@ -444,7 +445,9 @@ handleCommand :: Command -> PSCI ()
444445handleCommand (Expression val) = handleDeclaration val
445446handleCommand Help = PSCI $ outputStrLn helpMessage
446447handleCommand (Import moduleName) = handleImport moduleName
447−handleCommand (Let l) = PSCI $ lift $ modify (updateLets l)
448+handleCommand (Let l) = do
449+ PSCI $ lift $ modify (updateLets l)
450+ handleDeclaration (D.Var (N.Qualified (Just $ N.ModuleName [N.ProperName C.prelude]) (N.Ident C.unit)))
448451handleCommand (LoadFile filePath) = do
449452 absPath <- psciIO $ expandTilde filePath
450453 exists <- psciIO $ doesFileExist absPath
src/Language/PureScript/Constants.hs+3
@@ -153,6 +153,9 @@ mkFn = "mkFn"
153153runFn :: String
154154runFn = "runFn"
155155
156+unit :: String
157+unit = "unit"
158+
156159-- Prim values
157160
158161undefined :: String