Haskell stack memo

Links
Tips
How to rebuild precompiled packages
In some cases, stack says that precompiled packages are broken. This problem will solve following steps.
- unregister package by ghc-pkg
- delete precompiled package files of stack
In following instruction,
the target package name will denote as “package”.
In stack message,
the pakcage name is denote with version number, like package-1.0.1.
1. unregister package by ghc-pkg
delete package
stack exec -- ghc-pkg unregister --force package
check deletion
stack exec -- ghc-pkg list | grep package
When there are several version of GHC, these commands may not work well. Then do below.
- find ghc-pkg manageing the target pakcage
- ex : ~/.stack/programs/x86_64-osx/ghc-7.10.2/bin/ghc-pkg
$ghcpkgin following
- find database file
- ex : ~/.stack/snapshots/x86_64-osx/lts-3.1/7.10.2/pkgdb
$pkgdbin following
- delete package
- do >
$ghcpkg--package-db$pkgdbunregister--forcepackage
- do >
- check deletion
- do >
$ghcpkg--package-db$pkgdblist | grep package
- do >
2. delete precompiled package files of stack
find ~/.stack/precompiled -type d -name package-* | xargs rm -rf
After deletion
Do stack build, stack install ... or something.
You may see that stack recompile the target pakcages.