@@ -276,7 +276,7 @@ handleDeclaration :: P.Expr -> PSCI ()
276276handleDeclaration value = do
277277 st <- PSCI $ lift get
278278 let m = createTemporaryModule True st value
279− e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [("$PSCI.purs", m)]) []
279+ e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [("$PSCI.purs", m)]) []
280280 case e of
281281 Left err -> PSCI $ outputStrLn err
282282 Right _ -> do
@@ -295,7 +295,7 @@ handleTypeOf :: P.Expr -> PSCI ()
295295handleTypeOf value = do
296296 st <- PSCI $ lift get
297297 let m = createTemporaryModule False st value
298− e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [("$PSCI.purs", m)]) []
298+ e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [("$PSCI.purs", m)]) []
299299 case e of
300300 Left err -> PSCI $ outputStrLn err
301301 Right env' ->
@@ -311,7 +311,7 @@ handleKindOf typ = do
311311 st <- PSCI $ lift get
312312 let m = createTemporaryModuleForKind st typ
313313 mName = P.ModuleName [P.ProperName "$PSCI"]
314− e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [("$PSCI.purs", m)]) []
314+ e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [("$PSCI.purs", m)]) []
315315 case e of
316316 Left err -> PSCI $ outputStrLn err
317317 Right env' ->
@@ -329,13 +329,13 @@ handleKindOf typ = do
329329-- |
330330-- Parses the input and returns either a Metacommand or an expression.
331331--
332−getCommand :: InputT (StateT PSCiState IO) (Either ParseError (Maybe Command))
333−getCommand = do
332+getCommand :: Bool -> InputT (StateT PSCiState IO) (Either ParseError (Maybe Command))
333+getCommand singleLineMode = do
334334 firstLine <- getInputLine "> "
335335 case firstLine of
336336 Nothing -> return (Right Nothing)
337337 Just "" -> return (Right Nothing)
338− Just s@ (':' : _) -> return . either Left (Right . Just) $ parseCommand s -- The start of a command
338+ Just s | singleLineMode || head s == ':' -> return . either Left (Right . Just) $ parseCommand s
339339 Just s -> either Left (Right . Just) . parseCommand <$> go [s]
340340 where
341341 go :: [String] -> InputT (StateT PSCiState IO) String
@@ -371,9 +371,16 @@ handleCommand (TypeOf val) = handleTypeOf val
371371handleCommand (KindOf typ) = handleKindOf typ
372372handleCommand _ = PSCI $ outputStrLn "Unknown command"
373373
374+singleLineFlag :: Cmd.Term Bool
375+singleLineFlag = Cmd.value $ Cmd.flag $ (Cmd.optInfo ["single-line-mode"])
376+ { Cmd.optName = "Single-line mode"
377+ , Cmd.optDoc = "Run in single-line mode"
378+ }
379+
374380inputFiles :: Cmd.Term [FilePath]
375381inputFiles = Cmd.value $ Cmd.posAny [] $ Cmd.posInfo { Cmd.posName = "file(s)"
376− , Cmd.posDoc = "Optional .purs files to load on start" }
382+ , Cmd.posDoc = "Optional .purs files to load on start"
383+ }
377384
378385loadUserConfig :: IO (Maybe [Command])
379386loadUserConfig = do
@@ -391,8 +398,8 @@ loadUserConfig = do
391398-- |
392399-- The PSCI main loop.
393400--
394−loop :: [FilePath] -> IO ()
395−loop files = do
401+loop :: Bool -> [FilePath] -> IO ()
402+loop singleLineMode files = do
396403 config <- loadUserConfig
397404 preludeFilename <- P.preludeFilename
398405 filesAndModules <- mapM (\file -> fmap (fmap (map ((,) file))) . loadModule $ file) (preludeFilename : files)
@@ -409,7 +416,7 @@ loop files = do
409416 where
410417 go :: InputT (StateT PSCiState IO) ()
411418 go = do
412− c <- getCommand
419+ c <- getCommand singleLineMode
413420 case c of
414421 Left err -> outputStrLn (show err) >> go
415422 Right Nothing -> go
@@ -417,7 +424,7 @@ loop files = do
417424 Right (Just c') -> runPSCI (handleCommand c') >> go
418425
419426term :: Cmd.Term (IO ())
420−term = loop <$> inputFiles
427+term = loop <$> singleLineFlag <*> inputFiles
421428
422429termInfo :: Cmd.TermInfo
423430termInfo = Cmd.defTI