@@ -66,7 +66,7 @@ import qualified Language.PureScript.Declarations as D
6666data PSCiState = PSCiState
6767 { psciImportedFilenames :: [FilePath ]
6868 , psciImportedModuleNames :: [P. ModuleName ]
69- , psciLoadedModules :: [(FilePath , P. Module )]
69+ , psciLoadedModules :: [(Maybe 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 :: [(FilePath , P. Module )] -> PSCiState -> PSCiState
90+ updateModules :: [(Maybe 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 [(FilePath , P. Module )])
133+ loadAllModules :: [FilePath ] -> IO (Either ParseError [(Maybe FilePath , P. Module )])
134134loadAllModules files = do
135135 filesAndContent <- forM files $ \ filename -> do
136136 content <- U. readFile filename
137- return (filename, content)
138- return $ P. parseModulesFromFiles $ (" <prelude> " , P. prelude) : filesAndContent
137+ return (Just filename, content)
138+ return $ P. parseModulesFromFiles $ (Nothing , 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 ++ [(" $PSCI.purs " , m)]) []
306+ e <- psciIO . runMake $ P. make modulesDir options (psciLoadedModules st ++ [(Nothing , m)]) []
307307 case e of
308308 Left err -> PSCI $ outputStrLn err
309309 Right _ -> do
@@ -341,13 +341,13 @@ handleShowImportedModules = do
341341--
342342handleImport :: P. ModuleName -> PSCI ()
343343handleImport moduleName = do
344- s <- liftM ( updateImports moduleName) $ PSCI $ lift get
345- let m = createTemporaryModuleForImports s
346- e <- psciIO . runMake $ P. make modulesDir options (psciLoadedModules s ++ [(" $PSCI.purs " , m)]) []
344+ st <- updateImports moduleName <$> PSCI ( lift get)
345+ let m = createTemporaryModuleForImports st
346+ e <- psciIO . runMake $ P. make modulesDir options (psciLoadedModules st ++ [(Nothing , m)]) []
347347 case e of
348348 Left err -> PSCI $ outputStrLn err
349349 Right _ -> do
350- PSCI $ lift $ put s
350+ PSCI $ lift $ put st
351351 return ()
352352
353353-- |
@@ -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 ++ [(" $PSCI.purs " , m)]) []
360+ e <- psciIO . runMake $ P. make modulesDir options (psciLoadedModules st ++ [(Nothing , 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 ++ [(" $PSCI.purs " , m)]) []
410+ e <- psciIO . runMake $ P. make modulesDir options (psciLoadedModules st ++ [(Nothing , 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 ((,) absPath) mods))
456+ Right mods -> PSCI . lift $ modify (updateModules (map ((,) ( Just absPath) ) mods))
457457 else
458458 PSCI . outputStrLn $ " Couldn't locate: " ++ filePath
459459handleCommand Reset = do
@@ -504,7 +504,7 @@ loop singleLineMode files = do
504504 Left err -> putStrLn (show err) >> exitFailure
505505 Right modules -> do
506506 historyFilename <- getHistoryFilename
507- let settings = defaultSettings {historyFile = Just historyFilename}
507+ let settings = defaultSettings { historyFile = Just historyFilename }
508508 flip evalStateT (PSCiState files defaultImports modules [] ) . runInputT (setComplete completion settings) $ do
509509 outputStrLn prologueMessage
510510 traverse_ (mapM_ (runPSCI . handleCommand)) config
0 commit comments