@@ -13,7 +13,11 @@
1313--
1414-----------------------------------------------------------------------------
1515
16−{-# LANGUAGE DataKinds, DoAndIfThenElse, FlexibleContexts, GeneralizedNewtypeDeriving #-}
16+{-# LANGUAGE DataKinds #-}
17+{-# LANGUAGE DoAndIfThenElse #-}
18+{-# LANGUAGE FlexibleContexts #-}
19+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
20+{-# LANGUAGE RecordWildCards #-}
1721
1822module Main where
1923
@@ -53,9 +57,8 @@ import qualified Paths_purescript as Paths
5357import Commands as C
5458import Parser
5559
56−
5760data PSCiOptions = PSCiOptions
58− { psciSingleLineFlag :: Bool
61+ { psciMultiLineMode :: Bool
5962 , psciInputFile :: [FilePath]
6063 }
6164
@@ -182,8 +185,6 @@ prologueMessage = intercalate "\n"
182185 , " |_| "
183186 , ""
184187 , ":? shows help"
185− , ""
186− , "Expressions are terminated using Ctrl+D"
187188 ]
188189
189190-- |
@@ -599,32 +600,33 @@ loadUserConfig = do
599600-- The PSCI main loop.
600601--
601602loop :: PSCiOptions -> IO ()
602−loop (PSCiOptions singleLineMode files) = do
603+loop PSCiOptions{..} = do
603604 config <- loadUserConfig
604− modulesOrFirstError <- loadAllModules files
605+ modulesOrFirstError <- loadAllModules psciInputFile
605606 case modulesOrFirstError of
606607 Left err -> print err >> exitFailure
607608 Right modules -> do
608609 historyFilename <- getHistoryFilename
609610 let settings = defaultSettings { historyFile = Just historyFilename }
610− flip evalStateT (PSCiState files defaultImports modules []) . runInputT (setComplete completion settings) $ do
611+ flip evalStateT (PSCiState psciInputFile defaultImports modules []) . runInputT (setComplete completion settings) $ do
611612 outputStrLn prologueMessage
612613 traverse_ (mapM_ (runPSCI . handleCommand)) config
613614 go
614615 where
615616 go :: InputT (StateT PSCiState IO) ()
616617 go = do
617− c <- getCommand singleLineMode
618+ c <- getCommand (not psciMultiLineMode)
618619 case c of
619620 Left err -> outputStrLn err >> go
620621 Right Nothing -> go
621622 Right (Just Quit) -> outputStrLn quitMessage
622623 Right (Just c') -> runPSCI (loadAllImportedModules >> handleCommand c') >> go
623624
624−singleLineFlag :: Parser Bool
625−singleLineFlag = switch $
626− long "single-line-mode"
627− <> Opts.help "Run in single-line mode"
625+multiLineMode :: Parser Bool
626+multiLineMode = switch $
627+ long "multi-line-mode"
628+ <> short 'm'
629+ <> Opts.help "Run in multi-line mode (use ^D to terminate commands)"
628630
629631inputFile :: Parser FilePath
630632inputFile = strArgument $
@@ -632,7 +634,7 @@ inputFile = strArgument $
632634 <> Opts.help "Optional .purs files to load on start"
633635
634636psciOptions :: Parser PSCiOptions
635−psciOptions = PSCiOptions <$> singleLineFlag
637+psciOptions = PSCiOptions <$> multiLineMode
636638 <*> many inputFile
637639
638640main :: IO ()