@@ -234,7 +234,7 @@ instance P.MonadMake Make where
234 mkdirp path
234 mkdirp path
235 U.writeFile path text
235 U.writeFile path text
236 liftError = either throwError return
236 liftError = either throwError return
237− progress s = unless (s == "Compiling Main") $ makeIO . U.putStrLn $ s
237+ progress s = unless (s == "Compiling $PSCI") $ makeIO . U.putStrLn $ s
239mkdirp :: FilePath -> IO ()
239mkdirp :: FilePath -> IO ()
240mkdirp = createDirectoryIfMissing True . takeDirectory
240mkdirp = createDirectoryIfMissing True . takeDirectory
@@ -245,7 +245,7 @@ mkdirp = createDirectoryIfMissing True . takeDirectory
245createTemporaryModule :: Bool -> PSCiState -> P.Expr -> P.Module
245createTemporaryModule :: Bool -> PSCiState -> P.Expr -> P.Module
246createTemporaryModule exec PSCiState{psciImportedModuleNames = imports, psciLetBindings = lets} value =
246createTemporaryModule exec PSCiState{psciImportedModuleNames = imports, psciLetBindings = lets} value =
248− moduleName = P.ModuleName [P.ProperName "Main"]
248+ moduleName = P.ModuleName [P.ProperName "$PSCI"]
249 importDecl m = P.ImportDeclaration m P.Unqualified Nothing
249 importDecl m = P.ImportDeclaration m P.Unqualified Nothing
250 traceModule = P.ModuleName [P.ProperName "Debug", P.ProperName "Trace"]
250 traceModule = P.ModuleName [P.ProperName "Debug", P.ProperName "Trace"]
251 trace = P.Var (P.Qualified (Just traceModule) (P.Ident "print"))
251 trace = P.Var (P.Qualified (Just traceModule) (P.Ident "print"))
@@ -263,7 +263,7 @@ createTemporaryModule exec PSCiState{psciImportedModuleNames = imports, psciLetB
263createTemporaryModuleForKind :: PSCiState -> P.Type -> P.Module
263createTemporaryModuleForKind :: PSCiState -> P.Type -> P.Module
264createTemporaryModuleForKind PSCiState{psciImportedModuleNames = imports} typ =
264createTemporaryModuleForKind PSCiState{psciImportedModuleNames = imports} typ =
266− moduleName = P.ModuleName [P.ProperName "Main"]
266+ moduleName = P.ModuleName [P.ProperName "$PSCI"]
267 importDecl m = P.ImportDeclaration m P.Unqualified Nothing
267 importDecl m = P.ImportDeclaration m P.Unqualified Nothing
268 itDecl = P.TypeSynonymDeclaration (P.ProperName "IT") [] typ
268 itDecl = P.TypeSynonymDeclaration (P.ProperName "IT") [] typ
@@ -282,11 +282,11 @@ handleDeclaration :: P.Expr -> PSCI ()
282handleDeclaration value = do
282handleDeclaration value = do
283 st <- PSCI $ lift get
283 st <- PSCI $ lift get
284 let m = createTemporaryModule True st value
284 let m = createTemporaryModule True st value
285− e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [("Main.purs", m)])
285+ e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [("$PSCI.purs", m)])
286 case e of
286 case e of
287 Left err -> PSCI $ outputStrLn err
287 Left err -> PSCI $ outputStrLn err
288 Right _ -> do
288 Right _ -> do
289− psciIO $ writeFile indexFile $ "require('Main').main();"
289+ psciIO $ writeFile indexFile $ "require('$PSCI').main();"
290 process <- psciIO findNodeProcess
290 process <- psciIO findNodeProcess
291 result <- psciIO $ traverse (\node -> readProcessWithExitCode node [indexFile] "") process
291 result <- psciIO $ traverse (\node -> readProcessWithExitCode node [indexFile] "") process
292 case result of
292 case result of
@@ -301,11 +301,11 @@ handleTypeOf :: P.Expr -> PSCI ()
301handleTypeOf value = do
301handleTypeOf value = do
302 st <- PSCI $ lift get
302 st <- PSCI $ lift get
303 let m = createTemporaryModule False st value
303 let m = createTemporaryModule False st value
304− e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [("Main.purs", m)])
304+ e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [("$PSCI.purs", m)])
305 case e of
305 case e of
306 Left err -> PSCI $ outputStrLn err
306 Left err -> PSCI $ outputStrLn err
307 Right env' ->
307 Right env' ->
308− case M.lookup (P.ModuleName [P.ProperName "Main"], P.Ident "it") (P.names env') of
308+ case M.lookup (P.ModuleName [P.ProperName "$PSCI"], P.Ident "it") (P.names env') of
309 Just (ty, _, _) -> PSCI . outputStrLn . P.prettyPrintType $ ty
309 Just (ty, _, _) -> PSCI . outputStrLn . P.prettyPrintType $ ty
310 Nothing -> PSCI $ outputStrLn "Could not find type"
310 Nothing -> PSCI $ outputStrLn "Could not find type"
@@ -316,8 +316,8 @@ handleKindOf :: P.Type -> PSCI ()
316handleKindOf typ = do
316handleKindOf typ = do
317 st <- PSCI $ lift get
317 st <- PSCI $ lift get
318 let m = createTemporaryModuleForKind st typ
318 let m = createTemporaryModuleForKind st typ
319− mName = P.ModuleName [P.ProperName "Main"]
319+ mName = P.ModuleName [P.ProperName "$PSCI"]
320− e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [("Main.purs", m)])
320+ e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [("$PSCI.purs", m)])
321 case e of
321 case e of
322 Left err -> PSCI $ outputStrLn err
322 Left err -> PSCI $ outputStrLn err
323 Right env' ->
323 Right env' ->
@@ -340,6 +340,7 @@ getCommand = do
340 firstLine <- getInputLine "> "
340 firstLine <- getInputLine "> "
341 case firstLine of
341 case firstLine of
342 Nothing -> return (Right Nothing)
342 Nothing -> return (Right Nothing)
343+ Just "" -> return (Right Nothing)
343 Just s@ (':' : _) -> return . either Left (Right . Just) $ parseCommand s -- The start of a command
344 Just s@ (':' : _) -> return . either Left (Right . Just) $ parseCommand s -- The start of a command
344 Just s -> either Left (Right . Just) . parseCommand <$> go [s]
345 Just s -> either Left (Right . Just) . parseCommand <$> go [s]