|
|
|
|
|
by neilparikh
3174 days ago
|
|
One great approach is the Hoogle search engine for Haskell [1]. The idea with that is that you search by type, instead of name. So if you were looking for a function to take a item, and return a list with n copies of that item, you would search for `a -> Int -> [a]`, which would give you back replicate. Looks like the Nix expression language is untyped, so this wouldn't work directly, but maybe adding a rough type signature in the docstring would get some of those benefits (and it should be a bit better for discover-ability, since you wouldn't need to guess the same tags/concept the author choose). [1] - https://www.haskell.org/hoogle/ |
|
The way it works is you write a sequence of arguments and an expected result, and it suggests a method to call.
For example, I just now tried it, entering
in the input. It suggested the following methods: Clicking on any of these opens a browser on the class and method concerned.Another example: input of
yielded the single suggestion Another: yields ;;--It's a total hack, of course, but none the less effective or useful for that.
It has a list of methods marked "safe to experiment with", and simply tries them out.
It gets a big boost from being able to evaluate the receiver (the first in the input list) to a concrete object, and then only consider methods on that object's class.