How to remove a cabal package from the local system?

Evan Laforge qdunkan at gmail.com
Wed Jan 21 15:56:53 UTC 2015


I use a shell script.  It's really useful, surely there's some
official way to do this?

#!/bin/zsh

package=$1

if ! ghc-pkg describe $package >/dev/null; then
    echo no such package: $package
    exit 1
fi

ghcdir=$(ghc --print-libdir)

function field() {
    ghc-pkg field $package $1 | cut -d' ' -f2-
    return $?
}

libdir=$(field library-dirs)
hidir=$(field import-dirs)
html=$(dirname $(field haddock-html))

echo rm -rf $libdir $hidir $html
echo -n 'remove? '
read response
if [[ $response = y ]]; then
    # ghc-pkg unregister will complain if this will break other packages
    if ! ghc-pkg unregister $package; then
        exit 1
    fi
    rm -rf $libdir $hidir $html
fi

On Wed, Jan 21, 2015 at 11:36 PM, Volker Wysk <verteiler at volker-wysk.de> wrote:
> Hi!
>
> I have installed/registered a new version of a package with cabal by accident.
> How can I remove it again?
>
> There is something in ~/.cabal/packages/hackage.haskell.org, but the defective
> version isn't included.
>
> bye
> V.W.
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


More information about the Glasgow-haskell-users mailing list