A universal REPL which can be used on top of a Curry compiler
mainREPL
:: CCDescription -> IO ()
The main operation to start the REPL. It is parameterized over a description of a Curry compiler.
processArgsAndStart
:: ReplState -> [String] -> IO ()
May a String
be a REPL command?
printHelp
:: ReplState -> IO ()
calcPrompt
:: ReplState -> String
substS
:: String -> String -> String
cleanUpAndExitRepl
:: ReplState -> IO ()
processInput
:: ReplState -> String -> IO ()
evalExpression
:: ReplState -> String -> IO ReplState
Evaluate an expression w.r.t. currently loaded modules
importUnsafeModule
:: ReplState -> IO Bool
currentFrontendParams
:: ReplState -> Bool -> FrontendParams
compilerOutDir
:: ReplState -> String
acyFileName
:: ReplState -> String -> String
verbCallFrontendWithParams
:: ReplState -> FrontendTarget -> FrontendParams -> String -> IO ()
writeSimpleMainExpFile
:: ReplState -> String -> IO ()
writeMainExpFile
:: ReplState -> [String] -> Maybe String -> String -> IO ()
getAcyOfMainExpMod
:: ReplState -> IO (Maybe CurryProg)
getAcyOfExpr
:: ReplState -> String -> IO (Maybe CurryProg)
printTypeOfExp
:: ReplState -> String -> IO Bool
getModuleOfFunction
:: ReplState -> String -> IO String
processCommand
:: ReplState -> String -> IO (Maybe ReplState)
unsafeExec
:: ReplState -> IO (Maybe ReplState) -> IO (Maybe ReplState)
replCommands
:: [(String, ReplState -> String -> IO (Maybe ReplState))]
skipCommand
:: String -> IO (Maybe ReplState)
Skip an erroneous command with an error message
processSysCall
:: ReplState -> String -> IO (Maybe ReplState)
Execute a call to a system command
processAdd
:: ReplState -> String -> IO (Maybe ReplState)
Process :add command
processBrowse
:: ReplState -> String -> IO (Maybe ReplState)
Process :browse command
processCd
:: ReplState -> String -> IO (Maybe ReplState)
Process :cd command
processCompile
:: ReplState -> String -> IO (Maybe ReplState)
Process :compile command
processEdit
:: ReplState -> String -> IO (Maybe ReplState)
Process :edit command
processEval
:: ReplState -> String -> IO (Maybe ReplState)
Process :eval command
processFork
:: ReplState -> String -> IO (Maybe ReplState)
Process :fork command
processHelp
:: ReplState -> String -> IO (Maybe ReplState)
Process :help command
processInterface
:: ReplState -> String -> IO (Maybe ReplState)
Process :interface command
processLoad
:: ReplState -> String -> IO (Maybe ReplState)
Process :load command
processReload
:: ReplState -> String -> IO (Maybe ReplState)
Process :reload command
processModules
:: ReplState -> String -> IO (Maybe ReplState)
Process :modules command
processPrograms
:: ReplState -> String -> IO (Maybe ReplState)
Process :programs command
processQuit
:: ReplState -> String -> IO (Maybe ReplState)
Process :quit command
processSave
:: ReplState -> String -> IO (Maybe ReplState)
processShow
:: ReplState -> String -> IO (Maybe ReplState)
Process :show command
processSource
:: ReplState -> String -> IO (Maybe ReplState)
Process :source command
processType
:: ReplState -> String -> IO (Maybe ReplState)
Process :type command
processUsedImports
:: ReplState -> String -> IO (Maybe ReplState)
Process :usedimports command
printAllLoadedModules
:: ReplState -> IO ()
Print all Curry programs in current load path. Programs found in subdirectories are assumed to be hierarchical. To avoid loops in cyclic directory structure, we put a depth limit on the recursive search.
printAllLoadPathPrograms
:: ReplState -> IO ()
Print all Curry programs in current load path. Programs found in subdirectories are assumed to be hierarchical. To avoid loops in cyclic directory structure, we put a depth limit on the recursive search.
processSetOption
:: ReplState -> String -> IO (Maybe ReplState)
replOptions
:: ReplState -> [(String, ReplState -> String -> IO (Maybe ReplState))]
setPrompt
:: ReplState -> String -> IO (Maybe ReplState)
setTimeout
:: ReplState -> String -> IO (Maybe ReplState)
printOptions
:: ReplState -> IO ()
showCurrentOptions
:: ReplState -> String
formatVarVals
:: String -> [(String, String)] -> [String]
defaultImportPaths
:: ReplState -> IO [String]
The default import paths of the Curry compiler.
It consists of the path defined by the environment variable CURRYPATH,
and the "libraries" property defined in ~/.compilerrc
defaultImportPathsWith
:: ReplState -> String -> IO [String]
setOptionPath
:: ReplState -> String -> IO (Maybe ReplState)
compileMainExpression
:: ReplState -> String -> Bool -> IO Int
execAndRemove
:: ReplState -> String -> String -> IO Int
cleanModule
:: ReplState -> String -> IO ()
unlessKeepFiles
:: ReplState -> IO () -> IO ()
keepFiles
:: ReplState -> Bool
insertFreeVarsShowInMainExp
:: ReplState -> CurryProg -> String -> IO (Maybe (CurryProg, String, [String]))
breakWhereFreeClause
:: String -> (String, String)
makeMainExpMonomorphic
:: ReplState -> CurryProg -> String -> IO (Maybe (CurryProg, String))
If the main expression is polymorphic, make it monomorphic by adding
a type declaration where type variables are replaced by type ().
Before, type variables with a numeric constraint like Num/Integral
or
Fractional/Floating
are defaulted to the types Int
or Float,
respectively. The type of the main expression is only allowed to contain
numeric constraints.
If the main exp has type IO t
where t is monomorphic and not a function,
t /= (), and withShow
is True, then >>= print
is added
to the expression to print the computed value.
Otherwise (if the main exp has type IO t), >>= return
is added
in order to support raising non-determinism errors during the
monadic bind operation.
The arguments are the AbstractCurry program of the main expression
and the main expression as a string.
The result is Nothing (if some error occurred) or the transformed
AbstractCurry program and expression.
defaultQualTypeExpr
:: CQualTypeExpr -> CQualTypeExpr
substTypeVar
:: (Int, String) -> CTypeExpr -> CTypeExpr -> CTypeExpr
parseCurryProgram
:: ReplState -> String -> Bool -> IO (Maybe ReplState)
loadCurryProgram
:: ReplState -> String -> IO (Maybe ReplState)
compileCurryProgram
:: ReplState -> String -> IO (Maybe ReplState)
curryCompilerCommand
:: ReplState -> [String] -> String
getModuleName
:: ReplState -> String -> IO String
Extract a module name, possibly prefixed by a path, from an argument, or return the current module name if the argument is the empty string.
reduceVerbose
:: ReplState -> ReplState
showFunctionInModule
:: ReplState -> String -> String -> IO (Maybe ReplState)
getCpmTool
:: String -> IO (Maybe String)
checkAndCallCpmTool
:: String -> String -> (String -> IO (Maybe ReplState)) -> IO (Maybe ReplState)
execCommandWithPath
:: ReplState -> String -> [String] -> IO (Maybe ReplState)
checkForCommand
:: String -> String -> IO (Maybe ReplState) -> IO (Maybe ReplState)
checkForWish
:: IO (Maybe ReplState) -> IO (Maybe ReplState)
terminateSourceProgGUIs
:: ReplState -> IO ReplState