[Haskell-cafe] Re: [Haskell] Functor ((,) a)

Bas van Dijk v.dijk.bas at gmail.com
Wed Sep 19 06:38:46 EDT 2007

On 9/19/07, Janis Voigtlaender <voigt at tcs.inf.tu-dresden.de> wrote:
> BTW, what would have been the easiest way for me to find this out on my
> own?

The following is probably not the easiest way:

I keep a copy of the sources of GHC and the libraries [1] on my disk.
When I want to search for something I simply do a grep. In emacs you
also have a grep-find function which performs a grep in the background
and shows the result in a new buffer. The results are hyperlinked so
you can just click on a result and emacs will open the respected file
and jump to the found string.

In your case you do a 'M-x grep-find' followed by the search string:
"instance Functor ((,)".
This will result in:

./Control/Monad/Instances.hs:19:instance Functor ((->) r) where
./_darcs/pristine/Control/Monad/Instances.hs:19:instance Functor ((->) r) where

I think you can get rid of the annoying _darcs... by following: [3]. I
haven't tried that though.

(Note I'm on Linux. I don't know if this works in Windows. It probably
does with Cygwin.)

Of course the disadvantage of this approach is that you have to know
exactly what you are looking for.

Then there's also Hoogle [3] with which you can search for names or
types. However in your case this wouldn't have helped.



[1] http://hackage.haskell.org/trac/ghc/wiki/Building/GettingTheSources
[2] http://wiki.darcs.net/DarcsWiki/HintsAndTips#head-c189bd259a3d141796ebb4f8d58b8a7664c52ece
[3] http://haskell.org/hoogle

More information about the Haskell-Cafe mailing list