git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Avoid updating state unnecessarily
d1f6710Gary Burgess
psci/Main.hs+3−6
@@ -317,15 +317,12 @@ handleDeclaration value = do
317handleLet :: (P.Expr -> P.Expr) -> PSCI ()
317handleLet :: (P.Expr -> P.Expr) -> PSCI ()
318handleLet l = do
318handleLet l = do
319 st <- PSCI $ lift get
319 st <- PSCI $ lift get
320− PSCI $ lift $ modify (updateLets l)
320+ let st' = updateLets l st
321− st' <- PSCI $ lift get
322 let m = createTemporaryModule False st' (P.ObjectLiteral [])
321 let m = createTemporaryModule False st' (P.ObjectLiteral [])
323 e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st' ++ [(Left P.RebuildAlways, m)]) []
322 e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st' ++ [(Left P.RebuildAlways, m)]) []
324 case e of
323 case e of
325− Left err -> do
326− PSCI $ outputStrLn err
324+ Left err -> PSCI $ outputStrLn err
327− PSCI $ lift (put st)
325+ Right _ -> PSCI $ lift (put st')
328− Right _ -> return ()
329
326
330-- |
327-- |
331-- Show actual loaded modules in psci.
328-- Show actual loaded modules in psci.