Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to search for typeclass instances on Hoogle?

Is there a way to search for instances of a typeclass on Hoogle (or Stackage)?

For instance, I want to know which package defines an instance of Lift for Text.

I was able to find it in the package th-lift-instances, but it took about 10 minutes of manual searching. It seems like there should be some functionality of Hoogle that allows searching for instances.

like image 743
illabout Avatar asked Oct 06 '15 16:10

illabout


2 Answers

For now, no. However, a feature was recently added to haddock to allow instances to link to their source, and all new documentation built on Hackage has that turned on. So in the next release of the th-lift package, you should see a "Source" link next to the Lift Text instance that will tell you what you need to know.

like image 58
Daniel Wagner Avatar answered Sep 21 '22 15:09

Daniel Wagner


Expanding on Kolmar's comment, some Google techniques do go a long way towards finding instances.

Examples:

  • site:hackage.haskell.org "instance Lift Text"
  • site:hackage.haskell.org "instance Default" -inurl:Default (*Opts OR *Options OR *Config)
  • site:hackage.haskell.org "instance Num"
  • site:hackage.haskell.org "instance Monoid" -inurl:monoid

-inurl: is used to clean up superfluous results from where the typeclass was defined.

like image 35
Wizek Avatar answered Sep 19 '22 15:09

Wizek