Appendix C. REPL commands
The Idris REPL is presented as a practical command center for exploring code interactively, checking types, inspecting definitions, and even compiling or running programs. The text emphasizes that many of these commands are introduced throughout the book, while a broader set is available for more advanced use. If a user needs additional help or a full list of options, the REPL itself can provide guidance through its built-in help command.
At a high level, the commands fall into a few useful groups. Some are for evaluating and examining expressions, such as running an expression directly, checking its type, or looking up whether a function is total. Others help with understanding code structure and documentation, including commands to show documentation, print a definition, or browse names and types in a namespace. This makes the REPL not just an execution tool, but also an environment for learning about programs and libraries as they are developed.
The remaining commands focus on managing the development workflow: users can define temporary bindings, reload a module, load files, import extra modules, search by word or by type, compile to an executable, or execute compiled code. Together, these commands support a smooth interactive loop for experimentation, inspection, and testing. The REPL is therefore shown as an essential part of Idris development, combining exploration, compilation, and discovery in one interface.
FAQ
What does typing an expression at the Idris REPL do?
It evaluates the expression and displays the result. The REPL also stores that result in the variableit for use in later commands.How do I check the type of an expression in Idris?
Use:t <expression>. This command displays the type of the expression you provide.How can I see whether a function is total?
Use:total <name>. Idris will display whether the named function is total.How do I view documentation for a name at the REPL?
Use:doc <name>. This shows the documentation associated with that name.How do I add a new definition while working in the REPL?
Use:let <definition>. This adds a new definition interactively without leaving the REPL.What does :exec do in Idris?
:exec <expression> compiles and executes the given expression. If no expression is provided, it compiles and executes main.How do I compile a program to an executable from the REPL?
Use:c <output file>. This compiles the current program into an executable with main as the entry point.How do I reload the current module after making changes?
Use:r. This reloads the current module in the REPL.How do I load a different file or import an extra module in Idris?
Use:l <filename> to load a new file, or :module <module name> to import an extra module for use at the REPL.How can I search for names, types, or definitions in the REPL?
Use:apropos <word> to search function names, types, and documentation by keyword, :search <type> to find functions with a given type, and :browse <namespace> to list names and types in a namespace.
Type-Driven Development with Idris ebook for free