@@ -66,7 +66,7 @@ import qualified Language.PureScript.Declarations as D
66data PSCiState = PSCiState
66data PSCiState = PSCiState
67 { psciImportedFilenames :: [FilePath]
67 { psciImportedFilenames :: [FilePath]
68 , psciImportedModuleNames :: [P.ModuleName]
68 , psciImportedModuleNames :: [P.ModuleName]
69− , psciLoadedModules :: [(FilePath, P.Module)]
69+ , psciLoadedModules :: [(Maybe FilePath, P.Module)]
70 , psciLetBindings :: [P.Expr -> P.Expr]
70 , psciLetBindings :: [P.Expr -> P.Expr]
@@ -87,7 +87,7 @@ updateImports name st = st { psciImportedModuleNames = name : psciImportedModule
88-- Updates the state to have more loaded files.
88-- Updates the state to have more loaded files.
90−updateModules :: [(FilePath, P.Module)] -> PSCiState -> PSCiState
90+updateModules :: [(Maybe FilePath, P.Module)] -> PSCiState -> PSCiState
91updateModules modules st = st { psciLoadedModules = psciLoadedModules st ++ modules }
91updateModules modules st = st { psciLoadedModules = psciLoadedModules st ++ modules }
@@ -130,12 +130,12 @@ loadModule filename = either (Left . show) Right . P.runIndentParser filename P.
131-- Load all modules, including the Prelude
131-- Load all modules, including the Prelude
133−loadAllModules :: [FilePath] -> IO (Either ParseError [(FilePath, P.Module)])
133+loadAllModules :: [FilePath] -> IO (Either ParseError [(Maybe FilePath, P.Module)])
134loadAllModules files = do
134loadAllModules files = do
135 filesAndContent <- forM files $ \filename -> do
135 filesAndContent <- forM files $ \filename -> do
136 content <- U.readFile filename
136 content <- U.readFile filename
137− return (filename, content)
137+ return (Just filename, content)
138− return $ P.parseModulesFromFiles $ ("<prelude>", P.prelude) : filesAndContent
138+ return $ P.parseModulesFromFiles $ (Nothing, P.prelude) : filesAndContent
@@ -303,7 +303,7 @@ handleDeclaration :: P.Expr -> PSCI ()
303handleDeclaration value = do
303handleDeclaration value = do
304 st <- PSCI $ lift get
304 st <- PSCI $ lift get
305 let m = createTemporaryModule True st value
305 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)]) []
307 case e of
307 case e of
308 Left err -> PSCI $ outputStrLn err
308 Left err -> PSCI $ outputStrLn err
309 Right _ -> do
309 Right _ -> do
@@ -341,13 +341,13 @@ handleShowImportedModules = do
342handleImport :: P.ModuleName -> PSCI ()
342handleImport :: P.ModuleName -> PSCI ()
343handleImport moduleName = do
343handleImport moduleName = do
344− s <- liftM (updateImports moduleName) $ PSCI $ lift get
344+ st <- updateImports moduleName <$> PSCI (lift get)
345− let m = createTemporaryModuleForImports s
345+ let m = createTemporaryModuleForImports st
346− e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules s ++ [("$PSCI.purs", m)]) []
346+ e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [(Nothing, m)]) []
347 case e of
347 case e of
348 Left err -> PSCI $ outputStrLn err
348 Left err -> PSCI $ outputStrLn err
349 Right _ -> do
349 Right _ -> do
350− PSCI $ lift $ put s
350+ PSCI $ lift $ put st
351 return ()
351 return ()
@@ -357,7 +357,7 @@ handleTypeOf :: P.Expr -> PSCI ()
357handleTypeOf value = do
357handleTypeOf value = do
358 st <- PSCI $ lift get
358 st <- PSCI $ lift get
359 let m = createTemporaryModule False st value
359 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)]) []
361 case e of
361 case e of
362 Left err -> PSCI $ outputStrLn err
362 Left err -> PSCI $ outputStrLn err
363 Right env' ->
363 Right env' ->
@@ -407,7 +407,7 @@ handleKindOf typ = do
407 st <- PSCI $ lift get
407 st <- PSCI $ lift get
408 let m = createTemporaryModuleForKind st typ
408 let m = createTemporaryModuleForKind st typ
409 mName = P.ModuleName [P.ProperName "$PSCI"]
409 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)]) []
411 case e of
411 case e of
412 Left err -> PSCI $ outputStrLn err
412 Left err -> PSCI $ outputStrLn err
413 Right env' ->
413 Right env' ->
@@ -453,7 +453,7 @@ handleCommand (LoadFile filePath) = do
453 m <- psciIO $ loadModule absPath
453 m <- psciIO $ loadModule absPath
454 case m of
454 case m of
455 Left err -> PSCI $ outputStrLn err
455 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))
458 PSCI . outputStrLn $ "Couldn't locate: " ++ filePath
458 PSCI . outputStrLn $ "Couldn't locate: " ++ filePath
459handleCommand Reset = do
459handleCommand Reset = do
@@ -504,7 +504,7 @@ loop singleLineMode files = do
504 Left err -> putStrLn (show err) >> exitFailure
504 Left err -> putStrLn (show err) >> exitFailure
505 Right modules -> do
505 Right modules -> do
506 historyFilename <- getHistoryFilename
506 historyFilename <- getHistoryFilename
507− let settings = defaultSettings {historyFile = Just historyFilename}
507+ let settings = defaultSettings { historyFile = Just historyFilename }
508 flip evalStateT (PSCiState files defaultImports modules []) . runInputT (setComplete completion settings) $ do
508 flip evalStateT (PSCiState files defaultImports modules []) . runInputT (setComplete completion settings) $ do
509 outputStrLn prologueMessage
509 outputStrLn prologueMessage
510 traverse_ (mapM_ (runPSCI . handleCommand)) config
510 traverse_ (mapM_ (runPSCI . handleCommand)) config