Subject: GHC packages inputs leak in guix shell

From: Simon Tournier <[email-masked]>
Date: Wed, 04 Oct 2023 20:26:29 +0200

Hi,

Consider this:

--8<---------------cut here---------------start------------->8---
$ guix shell -C ghc-esqueleto ghc gcc-toolchain -- ghci
GHCi, version 9.2.5: https://www.haskell.org/ghc/  :? for help
ghci> import Data.ByteString.Base64.URL.Lazy
ghci> :t encode
encode
  :: Data.ByteString.Lazy.Internal.ByteString
     -> Data.ByteString.Lazy.Internal.ByteString
--8<---------------cut here---------------end--------------->8---

The package ghc-base64-bytestring should not be visible and instead, the
user should see:

    <no location info>: error:
        Could not find module `Data.ByteString.Base64.URL.Lazy'
        It is not a module in the current program, or in any known package.

See discussion for more details if needed.

        GHC packages' inputs leak in guix shell
        Saku Laesvuori <[email-masked]>
        Tue, 15 Aug 2023 09:51:50 +0300
        id:20230815065150.5joaxyts646mnpex@X-kone
        https://lists.gnu.org/archive/html/help-guix/2023-08
        https://yhetil.org/guix/20230815065150.5joaxyts646mnpex@X-kone

As reported in the discussion above, cabal is not exposing the package
required as dependency.

--8<---------------cut here---------------start------------->8---
$ guix shell -CN cabal-install coreutils zlib -D ghc-old-time
$ cabal update
$ env -u GHC_PACKAGE_PATH cabal install --lib esqueleto
$ ghci
ghci> import Database.Esqueleto.Experimental
ghci> :t encode

<interactive>:1:1: error: Variable not in scope: encode
ghci> import Data.ByteString.Base64.URL.Lazy

<no location info>: error:
    Could not load module `Data.ByteString.Base64.URL.Lazy'
    It is a member of the hidden package `base64-bytestring-1.2.1.0'.
    You can run `:set -package base64-bytestring' to expose it.
    (Note: this unloads all the modules in the current scope.)
--8<---------------cut here---------------end--------------->8---

Cheers,
simon