tags:

views:

198

answers:

1

I know a Haskell module name, but I can't figure out in what package it is defined. This is bad because I can't compile without a package exposing this module.

Specificaly it is Text.Regex that I can't locate, but I would like to know how to solve that problem in general.

+3  A: 

http://www.haskell.org/ghc/docs/latest/html/users_guide/packages.html

ghc-pkg find-module Text.Regex

But that only works for (a) recent GHCs, and (b) packages installed on your system.

You can also grep through the package file (e.g. /usr/lib/ghc-6.8.2/package.conf) to see what's installed.

You can also use either the haskell API search engines hoogle or the hackage search engine hayoo.

Text.Regex is in the package regex-base, and a few others built on top of it.

wnoise
I have ghc-pkg 6.8.2, and it does not accept find-module :(
luntain
I could find it only by clicking on a few of the results from hoogle. At the moment there seem to be no easy way to find those packages. Hopefully new release of ghc will fix this issue.
luntain
+1 Hoogle. It is by far the easiest way I have found. Command line stuff is a bit unnecessary when there's a perfectly good search engine option :) (imho)
OJ
That's less helpful when you're offline. Hopefully such barbarism is rare, but...
wnoise