Skip to content

Commit 6e52f89

Browse files
[ doc ] Expand help for fuzzy search (#3633)
* [ doc ] Expand help for fuzzy search * Apply suggestions from code review Co-authored-by: Mathew Polzin <[email protected]> * fix build --------- Co-authored-by: Mathew Polzin <[email protected]>
1 parent f3d62b8 commit 6e52f89

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/Idris/Parser.idr

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2269,7 +2269,26 @@ knownCommands =
22692269
"""
22702270
)
22712271
] ++
2272-
explain ["fs", "fsearch"] "Search for global definitions by sketching the names distribution of the wanted type(s)."
2272+
explain ["fs", "fsearch"] """
2273+
Search for global definitions by sketching the names distribution of the wanted type(s).
2274+
2275+
The parameter must be in one of the forms A -> B, A -> _, or B, where A and B are space-delimited lists of global names.
2276+
2277+
Idris will return all of the entries in the context that have all of the names in A
2278+
in some argument and all of the names in B within the return type.
2279+
2280+
For example:
2281+
2282+
:fs List Maybe -> List
2283+
2284+
will match (among other things):
2285+
2286+
Prelude.List.mapMaybe : (a -> Maybe b) -> List a -> List b
2287+
2288+
Note that the query 'List Nat -> String' does not describe the type 'List Nat',
2289+
rather it describes both 'List a' and 'Nat' in the arguments.
2290+
2291+
"""
22732292
where
22742293
explain : List String -> String -> List (String, String)
22752294
explain cmds expl = map (\s => (s, expl)) cmds

src/Idris/REPL/FuzzySearch.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fuzzySearch expr = do
3232
| _ => pure (REPLError ("Bad expression, expected"
3333
<++> code "B"
3434
<++> "or"
35-
<++> code "_ -> B"
35+
<++> code "A -> _"
3636
<++> "or"
3737
<++> code "A -> B"
3838
<+> ", where"

0 commit comments

Comments
 (0)