My concrete problem is this: I ran across the name throwT
in Module.hs
in a big Haskell project. I want to know what throwT
does. I eventually managed to figure this one out as follows:
:load Module.hs
followed by :i throwT
throwT :: Monad m => e -> Control.Monad.Trans.Either.EitherT e m r
-- Defined in ‘Data.EitherR’
Data.EitherR
, which points at the package errors
ghc-pkg list errors
gives errors-1.4.7
Is there a better way to do this, both in the sense of being more precise (step 3 is not), and less tedious?
You could use ghc-pkg find-module
instead of list
, which gives you the installed version of the package containing the module right away:
:load YourModule.hs
, get :info
on your valueghc-pkg find-module
.This still forces you to check the hackage documentation. However, if you add documentation: true
to your cabal configuration or --enable-documentation
, cabal will automatically build the documentation during the installation of the given package. Then you can shorten the procedure to
:load YourModule.hs
, get :info
on your valueThe local documentation will be stored in your cabal directory, or, if you are in a sandbox, in .cabal-sandbox/share/doc/<plattform>/index.html
.