Haskell has two search engines, appropriately called Hoogle and Hayoo!. Writing in Haskell, you’ll inevitably want to convert a value of one type to a value of another type. Or you’ll remember the type signature of a function but not its name. Hoogle and Hayoo! let you search for functions based on their type signature. Can’t remember how to parse a String as an Int? Search for “String -> Int” and it will find it.
First of all, thanks for featuring my favorite language this week on the Clojure Gazette! As a Haskeller first and a Clojurian second, this is something I dearly miss when programming in Clojure. Although I can see this as something that would be more difficult to implement in Clojure, given it’s dynamic nature. Maybe this is something that could be implemented on the subset of code that uses core.typed, core.contracts, and/or assertions?
That would be cool! A couple of thoughts come to mind:
Ambrose (the guy behind Typed Clojure) is really nice. You should ask him his thoughts on indexing the types of Clojure functions. It could be interesting.
My other thought is that, though it’s not nearly as rigorous, the clojure.core library does use pretty consistent argument names, often indicating the type. Could those be indexed?
Assertions, pre-conditions, contracts? Well, maybe. It’s all a matter of how much information you can extract from the code.