Search
Loading the index…
Law-shape search
A query with a standalone _, with brackets or ==, or that is one dotted name, is a shape. It finds every law (and every def whose type is an equation) whose statement contains that shape somewhere, on either side.
_matches one balanced sub-term: a name, a literal, a call likeList.append(a, A, xs, ys), or an operator term like1n+m. It never spans a comma, so it never matches two arguments.- Leading arguments can be left out.
List.append(_, Nil{})matchesList.append(a, A, xs, []): a call pattern with k arguments matches the last k arguments, because quantities and types come first in Bend. - Names match on a namespace suffix:
Csv.encode_row(_)findslib.Csv.encode_row([]), butode_rowfinds nothing. - Write constructors either way. Queries are rewritten the way bend prints terms:
Nil{}is[],Zero{}is0n,Succ{n}is1n+n, andCon{h, t}ish <> t(a chain ending inNil{}is a list literal). lhs == rhsmatches a whole equation, and each side of the pattern must cover a whole side:Nat.add(_, _) == Nat.add(_, _)finds commutativity-shaped laws.- A dotted name such as
List.lengthfinds every statement that mentions it; an undotted name such asNonedoes so in law shape mode.
Examples: List.append(_, Nil{}) · Nat.add(_, 0n) · List.reverse(List.reverse(_)) · Nat.add(_, _) == Nat.add(_, _)
Names and docs
Any other query searches declaration names and doc comments. Every word must appear. Exact names rank first, then prefixes, then names containing the word, then docs.
Statements are shown as bend 2.0.40 prints them. The index covers 464 packages (latest version of each).