fix pipe issue in REPL, add ability to dump top in repl
This commit is contained in:
@@ -14,6 +14,7 @@ data ReplCommand
|
||||
| GetDoc String
|
||||
| BrowseCmd QName
|
||||
| HelpCmd
|
||||
| DumpTop
|
||||
|
||||
kw : String → Parser String
|
||||
kw s = satisfy (\t => t.val.text == s) "Expected \{show s}"
|
||||
@@ -61,6 +62,7 @@ commands
|
||||
:: MkCmd ":d" "document function" ArgIdent GetDoc
|
||||
:: MkCmd ":doc" "document function" ArgIdent GetDoc
|
||||
:: MkCmd ":b" "browse namespace" ArgQName BrowseCmd
|
||||
:: MkCmd ":top" "dump top context as json" ArgNone DumpTop
|
||||
-- type at point
|
||||
-- solve hole
|
||||
-- search by prefix (for autocomplete - ideally include types at point, but we'd need recovery)
|
||||
|
||||
@@ -304,6 +304,9 @@ runCommand (GetDoc name) = getDoc name
|
||||
runCommand (Verbose Nothing) = modifyTop [ verbose $= _+_ 1 ]
|
||||
runCommand (Verbose (Just v)) = modifyTop [ verbose := v ]
|
||||
runCommand (OutputJS fn) = writeSource fn
|
||||
runCommand DumpTop = do
|
||||
json <- jsonTopContext
|
||||
putStrLn "TOP:\{renderJson json}"
|
||||
|
||||
-- Broken out to a separate function so I can hook it.
|
||||
runString : String → M Unit
|
||||
|
||||
@@ -389,7 +389,7 @@ instance HasIO IO where
|
||||
liftIO a = a
|
||||
|
||||
pfunc primPutStrLn uses (MkIORes MkUnit) : String → IO Unit := `(s) => (w) => {
|
||||
console.log(s)
|
||||
require('fs').writeSync(1, s + '\n')
|
||||
return Prelude_MkIORes(Prelude_MkUnit,w)
|
||||
}`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user