Thursday, June 26, 2008

GSoC Hoogle: Week 5

This week I was going to tackle type searching, but then realised I'm going to spend 6 hours on Friday on a train (hence the weekly update on Thursday), so can spend that time productively working on paper tackling type search. So instead of type search, I worked on a few other pieces, some of which make type search easier:

Haddock Database Generation More patches to get better output from Haddock. The code now handles class methods properly, and deals with some FFI bits.

Lazy Name Searching Searching for a name is now fairly lazy. When searching for a name, Hoogle can return the prefix of the results without doing too much computation to calculate all the results. This work is useful in its own right, but very necessary for the type searching, and can be reused.

Hoogle --info The biggest feature added this week is the --info flag. When this flag is given, Hoogle picks the first result and gives more details, including any Haddock documentation associated with the function. For example:


$ hoogle +tagsoup openurl --info
Text.HTML.Download openURL :: String -> IO String

This function opens a URL on the internet. Any http:// prefix is ignored.

> openURL "www.haskell.org/haskellwiki/Haskell"

Known Limitations:

* Only HTTP on port 80
* Outputs the HTTP Headers as well
* Does not work with all servers

It is hoped that a more reliable version of this function will be placed in a new HTTP library at some point!


Next week: Type searching! See last week for a description of what I hope to achieve.

User visible changes: The --info flag now exists.

2 comments:

  1. Anonymous9:03 PM

    Shouldn't that be the --im-feeling-lucky flag?

    ReplyDelete
  2. Anon: With Hoogle 3 it would have been a lucky guess, with Hoogle 4 you can do "hoogle Data.List.intersperse --info", which is no longer a search, but a rather specific request.

    Of course, it is more than a little similar to the feeling lucky.

    ReplyDelete