@@ -15,8 +15,9 @@
1515
1616module Commands where
1717
18−import Control.Applicative
19−import System.Console.Haskeline
18+import Language.PureScript
19+
20+import Text.Parsec
2021
2122-- |
2223-- Valid Meta-commands for PSCI
@@ -37,7 +38,7 @@ data Command
3738 -- |
3839 -- Import a module from a loaded file
3940 --
40− | Import String
41+ | Import ProperName
4142 -- |
4243 -- Load a file for use with importing
4344 --
@@ -57,30 +58,31 @@ data Command
5758 -- |
5859 -- An attempt at a meta command that wasn't recognized.
5960 --
60− | Unknown deriving (Show, Eq)
61+ | Unknown ParseError
6162
62−-- |
63−-- Parses the input and returns either a Metacommand or an expression.
64−--
65−getCommand :: InputT IO Command
66−getCommand = do
67− firstLine <- getInputLine "> "
68− case firstLine of
69− Nothing -> return Empty
70− Just ":?" -> return Help
71− Just (':':'i':' ':moduleName) -> return $ Import moduleName
72− Just (':':'m':' ':filePath) -> return $ LoadFile filePath
73− Just ":q" -> return Quit
74− Just ":r" -> return Reload
75− Just (':':'t':' ':expr) -> return $ TypeOf expr
76− Just (':':_) -> return Unknown
77− Just other -> Expression <$> go [other]
78− where
79− go ls = do
80− l <- getInputLine " "
81− case l of
82− Nothing -> return $ reverse ls
83− Just l' -> go (l' : ls)
63+---- |
64+---- Parses the input and returns either a Metacommand or an expression.
65+----
66+--getCommand :: InputT IO Command
67+--getCommand = do
68+-- firstLine <- getInputLine "> "
69+-- case firstLine of
70+-- Nothing -> return Empty
71+-- Just line -> psciParser psciHelp
72+-- --Just ":?" -> return Help
73+-- --Just (':':'i':' ':moduleName) -> return $ Import moduleName
74+-- --Just (':':'m':' ':filePath) -> return $ LoadFile filePath
75+-- --Just ":q" -> return Quit
76+-- --Just ":r" -> return Reload
77+-- --Just (':':'t':' ':expr) -> return $ TypeOf expr
78+-- --Just (':':_) -> return Unknown
79+-- --Just other -> Expression <$> go [other]
80+-- where
81+-- go ls = do
82+-- l <- getInputLine " "
83+-- case l of
84+-- Nothing -> return $ reverse ls
85+-- Just l' -> go (l' : ls)
8486
8587-- |
8688-- The help menu.