def uninstall(pkg,
              user=None,
              env=None):
    '''
    Uninstall a cabal package.

    pkg
        The package to uninstall
    user
        The user to run ghc-pkg unregister with
    env
        Environment variables to set when invoking cabal. Uses the
        same ``env`` format as the :py:func:`cmd.run
        <salt.modules.cmdmod.run>` execution function

    CLI Example:

    .. code-block:: bash

        salt '*' cabal.uninstall ShellCheck

    '''
    cmd = ['ghc-pkg unregister']
    cmd.append('"{0}"'.format(pkg))

    result = __salt__['cmd.run_all'](' '.join(cmd), runas=user, env=env)

    if result['retcode'] != 0:
        raise CommandExecutionError(result['stderr'])

    return result
Uninstall a cabal package.

    pkg
        The package to uninstall
    user
        The user to run ghc-pkg unregister with
    env
        Environment variables to set when invoking cabal. Uses the
        same ``env`` format as the :py:func:`cmd.run
        <salt.modules.cmdmod.run>` execution function

    CLI Example:

    .. code-block:: bash

        salt '*' cabal.uninstall ShellCheck