concept REPL in category idris
appears as: REPL, REPL, The REPL

This is an excerpt from Manning's book Type-Driven Development with Idris.
The syntax ?greeting introduces a hole, which is a part of the program yet to be written. You can type-check programs with holes and evaluate them at the REPL.
Refine— In the case where the input is non-empty, there’s a word as the first element (word) followed by the remainder of the list (words). You need to return a list with the length of word as its first element. For the moment, you can add a new hole (?rest) for the remainder of the list: You can even test this incomplete definition at the REPL. Note that the REPL doesn’t reload files automatically, because it runs independently of the interactive editing in Atom, so you’ll need to reload explicitly using the :r command:allLengths : List String -> List Nat allLengths [] = [] allLengths (word :: words) = length word :: ?restFor the hole rest, you need to calculate the lengths of the words in words. You can do this with a recursive call to allLengths, to complete the definition:*WordLength> :r Type Checking ./WordLength.idr Holes: Main.rest *WordLength> allLengths ["Hello", "Interactive", "Editors"] 5 :: ?rest : List NatallLengths : List String -> List Nat allLengths [] = [] allLengths (word :: words) = length word :: allLengths words
It’s always a good idea to test the resulting definition at the REPL:
Importing modules at the REPL
In the element lookup example, you import Data.Vect at the REPL using the :module command, to get access to the index function. There are several functions in the Prelude called index for indexing different list-like structures, so you have to disambiguate explicitly with Vect.index here.