@@ -58,18 +58,18 @@ updateBinders :: P.DoNotationElement -> PSCI -> PSCI
5858updateBinders name (PSCI i m b) = PSCI i m (b ++ [name])
5959
6060-- File helpers
61−getHistoryFilename :: IO FilePath
62−getHistoryFilename = getUserConfigFile "purescript" "psci_history"
63−
64−getPreludeFilename :: IO FilePath
65−getPreludeFilename = Paths.getDataFileName "prelude/prelude.purs"
61+defaultImports :: [P.ProperName]
62+defaultImports = [P.ProperName "Prelude", P.ProperName "Eff"]
6663
6764findNodeProcess :: IO (Maybe String)
6865findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names
6966 where names = ["nodejs", "node"]
7067
71−defaultImports :: [P.ProperName]
72−defaultImports = [P.ProperName "Prelude", P.ProperName "Eff"]
68+getHistoryFilename :: IO FilePath
69+getHistoryFilename = getUserConfigFile "purescript" "psci_history"
70+
71+getPreludeFilename :: IO FilePath
72+getPreludeFilename = Paths.getDataFileName "prelude/prelude.purs"
7373
7474loadModule :: FilePath -> IO (Either String [P.Module])
7575loadModule moduleFile = do
@@ -98,9 +98,7 @@ prologueMessage = intercalate "\n"
9898quitMessage :: String
9999quitMessage = "See ya!"
100100
101−options :: P.Options
102−options = P.Options True False True (Just "Main") True "PS" []
103−
101+-- Haskeline completions
104102completion :: [P.Module] -> CompletionFunc IO
105103completion ms = completeWord Nothing " \t\n\r" findCompletions
106104 where
@@ -119,6 +117,10 @@ completion ms = completeWord Nothing " \t\n\r" findCompletions
119117 getDeclName (P.ValueDeclaration ident _ _ _) = Just ident
120118 getDeclName _ = Nothing
121119
120+-- Compilation
121+options :: P.Options
122+options = P.Options True False True (Just "Main") True "PS" []
123+
122124createTemporaryModule :: [P.ProperName] -> [P.DoNotationElement] -> P.Value -> P.Module
123125createTemporaryModule imports binders value =
124126 let
@@ -147,6 +149,7 @@ handleDeclaration value (PSCI imports loadedModules binders) = do
147149 Just (ExitFailure _, _, err) -> outputStrLn err
148150 Nothing -> outputStrLn "Couldn't find node.js"
149151
152+-- Parser helpers
150153parseDoNotationLet :: Parsec.Parsec String P.ParseState P.DoNotationElement
151154parseDoNotationLet = P.DoNotationLet <$> (P.reserved "let" *> P.indented *> P.parseBinder)
152155 <*> (P.indented *> P.reservedOp "=" *> P.parseValue)
@@ -157,6 +160,7 @@ parseDoNotationBind = P.DoNotationBind <$> P.parseBinder <*> (P.indented *> P.re
157160parseExpression :: Parsec.Parsec String P.ParseState P.Value
158161parseExpression = P.whiteSpace *> P.parseValue <* Parsec.eof
159162
163+-- Commands
160164handleCommand :: Command -> StateT PSCI (InputT IO) ()
161165handleCommand Empty = return ()
162166handleCommand (Expression ls) =