@@ -26,8 +26,9 @@ import Data.Maybe (mapMaybe)
2626import Data.Traversable (traverse)
2727
2828import System.Console.Haskeline
29−import System.Directory (findExecutable)
29+import System.Directory (createDirectoryIfMissing, findExecutable)
3030import System.Exit
31+import System.Environment.XDG.BaseDir
3132import System.Process
3233
3334import qualified Language.PureScript as P
@@ -120,11 +121,19 @@ findNodeProcess :: IO (Maybe String)
120121findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names
121122 where names = ["nodejs", "node"]
122123
124+getHistoryFilename :: IO FilePath
125+getHistoryFilename = do
126+ purescriptConfig <- getUserConfigDir "purescript"
127+ createDirectoryIfMissing True purescriptConfig
128+ getUserConfigFile "purescript" "psci_history"
129+
123130main :: IO ()
124131main = do
125132 preludeFilename <- getPreludeFilename
126133 (Right prelude) <- loadModule preludeFilename
127− runInputT (setComplete (completion prelude) defaultSettings) $ do
134+ historyFilename <- getHistoryFilename
135+ let settings = defaultSettings {historyFile = Just historyFilename}
136+ runInputT (setComplete (completion prelude) settings) $ do
128137 outputStrLn " ____ ____ _ _ "
129138 outputStrLn "| _ \\ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_ "
130139 outputStrLn "| |_) | | | | '__/ _ \\___ \\ / __| '__| | '_ \\| __|"