I write a simple library with haskell and run below script
#!/bin/sh
set -e
dir=$(mktemp -d dist-docs.XXXXXX)
trap 'rm -r "$dir"' EXIT
# assumes cabal 2.4 or later
cabal v2-haddock --builddir="$dir" --haddock-for-hackage --enable-doc
cabal upload -d --publish $dir/*-docs.tar.gz
There throws a error like
hackage.haskell.org username: LIBO
hackage.haskell.org password:
Uploading documentation dist-docs.xhhhzj/Algebras-0.1.0.0-docs.tar.gz...
Error uploading documentation dist-docs.xhhhzj/Algebras-0.1.0.0-docs.tar.gz:
http code 404
Error: Package not found
No such package version for Algebras
You are trying to upload documentation for Algebras package, cabal complains that there is no such package and indeed it is right.
If you want to actually upload a package to Hackage
cabal upload dist-newstyle/sdist/Algebra-0.1.2.3.tar.gz
# this will upload a candidate package. Once you make
# sure everything is right add --publish
will do. I had no problems with Hackage building documentation in the past few years, so you shouldn’t need to upload it yourself, let the server do the job for you.
@wujilingfeng1 If you are writing a new package can I please discourage you from taking such a valuable part of the namespace as Algebras? Perhaps a codename, or Algebras-<codename>. For example I tend to name my packages after fish, e.g. opaleye.