[racket-dev] Roogle?

From: Anthony Cowley (acowley at seas.upenn.edu)
Date: Fri Aug 5 01:36:51 EDT 2011

On Fri, Aug 5, 2011 at 1:22 AM, Eli Barzilay <eli at barzilay.org> wrote:
> Two minutes ago, Anthony Cowley wrote:
>> On Fri, Aug 5, 2011 at 12:08 AM, Eli Barzilay <eli at barzilay.org> wrote:
>> > 6 minutes ago, Asumu Takikawa wrote:
>> >> A few of us in the lab today were discussing how the Haskell
>> >> community has this nice tool called Hoogle
>> >> (http://www.haskell.org/hoogle) that lets you search Haskell docs by
>> >> type.
>> >
>> > Are there any *practical* uses for that thing?
>> Hoogle is very popular among the Haskell community, and regularly
>> used by experienced programmers and as a resource neophytes are
>> pointed to.
> That's not surprising -- the question is how much the search-by-type
> feature is used vs the plain by-name searches.

Search-by-type is the main useful feature. Another search engine,
hayoo, often does better on name-based searches covering hackage. Some
people run local instances of hoogle as it is relatively
straightforward to hook into emacs and will index all the types and
names from all the packages you have installed locally.

>> On the teaching side, how much use students get out of hoogle varies
>> a lot. Some students struggle to get to the point where they can
>> adequately formulate the types they want, leaving hoogle a rather
>> pointless exercise somewhat akin to the frustration of a child using
>> a dictionary to look up how to spell a word (e.g. how can I find it
>> if I can't spell it?). Other students who embrace the
>> specification-side of programming seem to use it in an exploratory
>> manner as much as a name lookup service (e.g. this type seems
>> interesting, I wonder if it's a thing...).
> We already have that kind of exploratory searching, since "types" in
> the contract system are real functions.
> I guess that this is another way to make the point: in Haskell and
> other statically typed languages types are second-class, but in Racket
> they're first class so looking for a type name will get you
> information because it's also a binding.  (And the same goes for TR,
> only those are not runtime values.)

Searching by type names and aliases works fine:

Or go for a fancy-sounding abstraction and get a type class defined on
hackage: <http://www.haskell.org/hoogle/?hoogle=Bifunctor>

A nice feature of hoogle is that it is able to alpha vary types you
give it, so you can get quite far piecing a type together yourself
without worrying about naming conventions. That's what I meant about

Hoogle really is quite good, don't sell it short!


Posted on the dev mailing list.