| 
                    
                     
                       The main operation to start the REPL. It is parameterized over a description of a Curry compiler.  | 
                  
                
A universal REPL which can be used on top of a Curry compiler
Author: Michael Hanus
Version: August 2022
                mainREPL
                  ::  CCDescription -> IO ()  The main operation to start the REPL.  | 
              
            
                processArgsAndStart
                  ::  ReplState -> [String] -> IO ()   | 
              
            
                isCommand
                  ::  String -> Bool  May a String
                be a REPL command?
               | 
              
            
                printHelp
                  ::  ReplState -> IO ()   | 
              
            
                repLoop
                  ::  ReplState -> IO ()   | 
              
            
                mGetLine
                  ::  IO (Maybe String)   | 
              
            
                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.  | 
              
            
                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  | 
              
            
                printHelpOnCommands
                  ::  IO ()   | 
              
            
                printAllLoadedModules
                  ::  ReplState -> IO ()  Print all Curry programs in current load path.  | 
              
            
                printAllLoadPathPrograms
                  ::  ReplState -> IO ()  Print all Curry programs in current load path.  | 
              
            
                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.  | 
              
            
                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 ().
               | 
              
            
                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)   | 
              
            
                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   | 
              
            
| 
                    
                     
                       The main operation to start the REPL. It is parameterized over a description of a Curry compiler.  | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                       
                      May a   | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                       Evaluate an expression w.r.t. currently loaded modules  | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                       Skip an erroneous command with an error message  | 
                  
                
| 
                    
                     
                       Execute a call to a system command  | 
                  
                
| 
                    
                     
                       Process :add command  | 
                  
                
| 
                    
                     
                       Process :browse command  | 
                  
                
| 
                    
                     
                       Process :compile command  | 
                  
                
| 
                    
                     
                       Process :edit command  | 
                  
                
| 
                    
                     
                       Process :eval command  | 
                  
                
| 
                    
                     
                       Process :fork command  | 
                  
                
| 
                    
                     
                       Process :help command  | 
                  
                
| 
                    
                     
                       Process :interface command  | 
                  
                
| 
                    
                     
                       Process :load command  | 
                  
                
| 
                    
                     
                       Process :reload command  | 
                  
                
| 
                    
                     
                       Process :modules command  | 
                  
                
| 
                    
                     
                       Process :programs command  | 
                  
                
| 
                    
                     
                       Process :quit command  | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                       Process :show command  | 
                  
                
| 
                    
                     
                       Process :source command  | 
                  
                
| 
                    
                     
                       Process :type command  | 
                  
                
| 
                    
                     
                       Process :usedimports command  | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                       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.  | 
                  
                
| 
                    
                     
                       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.  | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                       
                      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 ~/.  | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                       
                      If the main expression is polymorphic, make it monomorphic by adding a type
declaration where type variables are replaced by type   | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                       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.  | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        | 
                  
                
| 
                    
                     
                        |