@@ -66,7 +66,7 @@ import qualified Language.PureScript.Declarations as D
6666data PSCiState = PSCiState
6767 { psciImportedFilenames :: [FilePath ]
6868 , psciImportedModuleNames :: [P. ModuleName ]
69- , psciLoadedModules :: [(Maybe FilePath , P. Module )]
69+ , psciLoadedModules :: [(Either P. RebuildPolicy FilePath , P. Module )]
7070 , psciLetBindings :: [P. Expr -> P. Expr ]
7171 }
7272
@@ -87,7 +87,7 @@ updateImports name st = st { psciImportedModuleNames = name : psciImportedModule
8787-- |
8888-- Updates the state to have more loaded files.
8989--
90- updateModules :: [(Maybe FilePath , P. Module )] -> PSCiState -> PSCiState
90+ updateModules :: [(Either P. RebuildPolicy FilePath , P. Module )] -> PSCiState -> PSCiState
9191updateModules modules st = st { psciLoadedModules = psciLoadedModules st ++ modules }
9292
9393-- |
@@ -130,12 +130,12 @@ loadModule filename = either (Left . show) Right . P.runIndentParser filename P.
130130-- |
131131-- Load all modules, including the Prelude
132132--
133- loadAllModules :: [FilePath ] -> IO (Either ParseError [(Maybe FilePath , P. Module )])
133+ loadAllModules :: [FilePath ] -> IO (Either ParseError [(Either P. RebuildPolicy FilePath , P. Module )])
134134loadAllModules files = do
135135 filesAndContent <- forM files $ \ filename -> do
136136 content <- U. readFile filename
137- return (Just filename, content)
138- return $ P. parseModulesFromFiles $ (Nothing , P. prelude) : filesAndContent
137+ return (Right filename, content)
138+ return $ P. parseModulesFromFiles ( either ( const " " ) id ) $ (Left P. RebuildNever , P. prelude) : filesAndContent
139139
140140
141141-- |
@@ -303,7 +303,7 @@ handleDeclaration :: P.Expr -> PSCI ()
303303handleDeclaration value = do
304304 st <- PSCI $ lift get
305305 let m = createTemporaryModule True st value
306- e <- psciIO . runMake $ P. make modulesDir options (psciLoadedModules st ++ [(Nothing , m)]) []
306+ e <- psciIO . runMake $ P. make modulesDir options (psciLoadedModules st ++ [(Left P. RebuildAlways , m)]) []
307307 case e of
308308 Left err -> PSCI $ outputStrLn err
309309 Right _ -> do
@@ -343,7 +343,7 @@ handleImport :: P.ModuleName -> PSCI ()
343343handleImport moduleName = do
344344 st <- updateImports moduleName <$> PSCI (lift get)
345345 let m = createTemporaryModuleForImports st
346- e <- psciIO . runMake $ P. make modulesDir options (psciLoadedModules st ++ [(Nothing , m)]) []
346+ e <- psciIO . runMake $ P. make modulesDir options (psciLoadedModules st ++ [(Left P. RebuildAlways , m)]) []
347347 case e of
348348 Left err -> PSCI $ outputStrLn err
349349 Right _ -> do
@@ -357,7 +357,7 @@ handleTypeOf :: P.Expr -> PSCI ()
357357handleTypeOf value = do
358358 st <- PSCI $ lift get
359359 let m = createTemporaryModule False st value
360- e <- psciIO . runMake $ P. make modulesDir options (psciLoadedModules st ++ [(Nothing , m)]) []
360+ e <- psciIO . runMake $ P. make modulesDir options (psciLoadedModules st ++ [(Left P. RebuildAlways , m)]) []
361361 case e of
362362 Left err -> PSCI $ outputStrLn err
363363 Right env' ->
@@ -407,7 +407,7 @@ handleKindOf typ = do
407407 st <- PSCI $ lift get
408408 let m = createTemporaryModuleForKind st typ
409409 mName = P. ModuleName [P. ProperName " $PSCI" ]
410- e <- psciIO . runMake $ P. make modulesDir options (psciLoadedModules st ++ [(Nothing , m)]) []
410+ e <- psciIO . runMake $ P. make modulesDir options (psciLoadedModules st ++ [(Left P. RebuildAlways , m)]) []
411411 case e of
412412 Left err -> PSCI $ outputStrLn err
413413 Right env' ->
@@ -453,7 +453,7 @@ handleCommand (LoadFile filePath) = do
453453 m <- psciIO $ loadModule absPath
454454 case m of
455455 Left err -> PSCI $ outputStrLn err
456- Right mods -> PSCI . lift $ modify (updateModules (map ((,) (Just absPath)) mods))
456+ Right mods -> PSCI . lift $ modify (updateModules (map ((,) (Right absPath)) mods))
457457 else
458458 PSCI . outputStrLn $ " Couldn't locate: " ++ filePath
459459handleCommand Reset = do
0 commit comments