concept expression search in category idris
appears as: Expression search, n expression search, expression searches, An expression search

This is an excerpt from Manning's book Type-Driven Development with Idris.
Expression search— Given a hole with a precise enough type, Idris can try to find an expression that satisfies the hole’s type, refining the definition.
Type— When Idris creates new holes, either from a case split or an incomplete result of an expression search, it’s always a good idea to inspect the types of those holes to get some insight into how to proceed. First, take a look at the type of ?transposeMat_rhs_1: Here, you’re trying to convert a 0 × n vector into an n × 0 vector, so you need to create n copies of an empty vector. We’ll return to this case later; for now, you can rename the hole to createEmpties and lift it to a top-level function with Ctrl-Alt-L:elem : Type n : Nat -------------------------------------- transposeMat_rhs_1 : Vect n (Vect 0 elem)createEmpties : Vect n (Vect 0 elem) transposeMat : Vect m (Vect n elem) -> Vect n (Vect m elem) transposeMat [] = createEmpties transposeMat (x :: xs) = ?transposeMat_rhs_2
As this example demonstrates, although expression search can often lead you to a valid function, it’s not a substitute for understanding how the program works! You need to understand the algorithm, but you can use expression search to help fill in the details.