Question

I'm reading some documentation on IxSet's http://happstack.com/docs/crashcourse/AcidState.html#ixset , and I was wondering about looking at source of Indexable typeclass which is imported from Data.IxSet.

So then I took a repository of Happstack and looked there (darcs get http://patch-tag.com/r/mae/happstack), but that got me to even bigger frustration.

I see the happstack/happstack-ixset/src/Happstack/Data/IxSet.hs file, which creates a module Happstack.Data.IxSet, but I can't see which file creates a module Data.IxSet (and implements class Indexable).

Was it helpful?

Solution

The go-to address for Haskell code is hackage. There is conveniently a link to Hayoo on the front page, the other major Haskell search engine besides Hoogle. Both have advantages above the other.

Hayoo indexes all packages on hackage and the searches by default include all packages on hackage. If you want to search for a known name, e.g. Indexable, that is the more convenient engine, especially if you don't know which package the name comes from. The - currently - fifth hit takes you to Data.IxSet.Indexable. On the right hand side of the Haddock docs, you find a Source link that takes you to the hscoloured sources (in this case, that's not very informative, though, there's only one class member, without default implementation, it tells you nothing above the docs).

Hoogle searches only a small number of packages by default, if you want to include other packages in the search, you have to specify that by adding +packagename to the search - but that restricts the search to the specified package. More about Hoogle searches in the manual. Hoogle's strength is the search by type. Hoogle's search by type applies more transformations to the searched type, and thus finds more matches than Hayoo's if you don't know the exact type (that is not without downsides, however, sometimes you get a lot of irrelevant hits). If you search for example Map k a -> k -> Maybe a, Hoogle's first result is the most likely candidate Data.Map.lookup :: Ord k => k -> Map k a -> Maybe a, whereas Hayoo doesn't find that because it doesn't permute arguments.

Either way, both search engines lead you to hackage's Haddock docs for the queried entity (if the search was successful), from where the Source links take you to the code, if you wish.

OTHER TIPS

Use Haddock documentation, locally-generated or online. Google search usually returns relevant docs near the top. The documentation is cross-linked so you can surf to the module you need. There's a link to the source next to each definition, for example.

This particular module belongs to the base libraries set.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top