How to get documentation for my Haskell package on Hackage?

UPDATE: This question is now out of date. Hackage now uses Haskell version 7.10.2 to build, so the next crash does not occur. Perhaps the change also violated some of the scenarios mentioned in the answers.

How do I get documentation for my Haskell package on Hackage?

My understanding is that this Hackage will build them, but I get an error

Resolving dependencies... cabal: Could not resolve dependencies: trying: MyPackage-0.1.0.2 (user goal) next goal: base (dependency of MyPackage-0.1.0.2) rejecting: base-4.7.0.1/installed-e4b... (conflict: MyPackage => base>=4.8 && <4.9) rejecting: base-4.8.1.0, 4.8.0.0, 4.7.0.2, 4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0, 4.5.1.0, 4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1, 4.2.0.0, 4.1.0.0, 4.0.0.0, 3.0.3.2, 3.0.3.1 (global constraint requires installed instance) Dependency tree exhaustively searched. 

I cannot lower the requirements for my package (which seems to be an obstacle to automatic assembly), and I see that some packages say "Documents uploaded by the user." However, any attempt to build does not work (see below.)

How do I get documentation for my Haskell package on Hackage? In particular, what do I need to do to download them myself?


I tried

 $ cp -R ./dist/doc/html/MyPackage/ MyPackage-0.1.0.2-docs $ tar cvzf --format=ustar -f MyPackage-0.1.0.2-docs.tar.gz MyPackage-0.1.0.2-docs $ curl -X PUT -H 'Content-Type: application/x-tar' -H 'Content-Encoding: gzip' --data-binary '@MyPackage-0.1.0.2-docs.tar.gz' 'https://hackage.haskell.org/package/MyPackage-0.1.0.2/docs' -u 'Rax' 

but get

Invalid tarball archive: the tarball file is not in the expected directory "MyPackage-0.1.0.2-docs"


 name: MyPackage version: 0.1.0.2 license: BSD3 license-file: LICENSE -- copyright: category: Development build-type: Simple -- extra-source-files: cabal-version: >= 1.22.1.1 library -- default-extensions: Trustworthy exposed-modules: MyMod.A, MyMod.AB other-modules: MyMod.C -- other-extensions: build-depends: base >= 4.8.1.0 && <4.9, containers >= 0.5.5.1, split >= 0.2.2, MissingH >= 1.3.0.1 -- hs-source-dirs: default-language: Haskell2010 

I also tried my own version of several scripts linked below, but I get the same error:

 #!/bin/bash cabal haddock --hyperlink-source --html-location='/package/$pkg-$version/docs' --contents-location='/package/$pkg' S=$? if [ "${S}" -eq "0" ]; then cd "dist/doc/html" DDIR="${1}-${2}-docs" cp -r "${1}" "${DDIR}" && tar -c -v -z --format=ustar -f "${DDIR}.tar.gz" "${DDIR}" CS=$? if [ "${CS}" -eq "0" ]; then echo "Uploading to Hackage…" curl -X PUT -H 'Content-Type: application/x-tar' -H 'Content-Encoding: gzip' --data-binary "@${DDIR}.tar.gz" --digest --netrc "https://hackage.haskell.org/package/${1}-${2}/docs" exit $? else echo "Error when packaging the documentation" exit $CS fi else echo "Error when trying to build the package." exit $S fi 

which I call with

 myscript MyPackage 0.1.0.2 

but get the same error.

+6
source share
2 answers

Even if the documents are based on a hack, they may appear for a while, and at some point they break down for a long period of time. I am used to doing this with the neil tool as described here:

http://neilmitchell.blogspot.si/2014/10/fixing-haddock-docs-on-hackage.html

First I install neil (in another sandbox on my disk), then in your library folder:

 neil docs --username=YourHackageUsername 

He takes care of all the details for you!

+4
source

Does your library require base >= 4.8.1.0 ?

Problem: Hackage is trying to use base == 4.7.0.1 , which conflicts with your cabal file.

I would see if you can create your own library with the base that Hackage uses.

Some links to loading documents in Hackage:

+5
source

All Articles