Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to locally generate a preview of the web page for my cabal package?

Tags:

haskell

cabal

From the Hackage check/upload page:

Checking a Cabal package

Re-uploading a package with the same version number is not permitted, so you might want to do some checking before uploading:

  • You could check that your source bundle builds, including the haddock documentation if it's a library.
  • The following form checks that a package is uploadable, warns about sundry other matters, and presents a preview of the web page for the package. It does not add the package to the database.

(my emphasis)

How do I generate a preview of the web page for the package locally? i.e. without using that website form?

(The "web page for the package" is e.g. this is QuickCheck's.)

like image 257
dave4420 Avatar asked Dec 06 '11 09:12

dave4420


People also ask

How do I run a cabal project?

To create a new project using Cabal, you should first be in a specific directory set aside for the project. Then you can use cabal init -n to create a project. This will auto-generate a . cabal file for you with defaults in all the metadata fields.

Where are cabal packages installed?

Using Cabal By default stack installs packages to ~/. cabal and ~/. ghc in your home directory.


1 Answers

You use cabal haddock to generate this page. This will generate the documentation in dist/doc/html/<library-or-executable-name>/index.html.

Additionally, you can edit your ~/.cabal/config file to include the line:

documentation: True

This will automatically install documentation for all of the packages you install with Cabal, and you will get a list of all installed modules on the system in the ~/.cabal/share/doc/index.html file; this is useful for ghci sessions or when you want to find out which package contains which modules, etc.

like image 179
dflemstr Avatar answered Oct 29 '22 17:10

dflemstr