Skip to content

how to cabal repl? #898

@jwaldmann

Description

@jwaldmann

From the top of this repo, I can do cabal test all, cabal bench set-benchmarks just fine. But:

$ cabal repl containers
Build profile: -w ghc-9.2.5 -O1
In order, the following will be built (use -v for more details):
 - containers-0.6.6 (lib) (ephemeral targets)
Preprocessing library for containers-0.6.6..
GHCi, version 9.2.5: https://www.haskell.org/ghc/  :? for help

<interactive>:1:1: error:
    attempting to use module ‘containers-0.6.6:Prelude’ (src/Prelude.hs) which is not loaded
Error: cabal: repl failed for containers-0.6.6.

There are other ways to fail, e.g.,

$ cabal exec -- ghci containers/src/Data/Set/Internal.hs 
Loaded package environment from /home/waldmann/projekte/containers/dist-newstyle/tmp/environment.-50893/.ghc.environment.x86_64-linux-9.2.5
GHCi, version 9.2.5: https://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Data.Set.Internal ( containers/src/Data/Set/Internal.hs, interpreted )

containers/src/Data/Set/Internal.hs:253:1: error:
    Ambiguous module name ‘Utils.Containers.Internal.StrictPair’:
      it was found in multiple packages:
      containers-0.6.6 containers-tests-0
    |
253 | import Utils.Containers.Internal.StrictPair
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

containers/src/Data/Set/Internal.hs:254:1: error:
    Could not load module ‘Utils.Containers.Internal.PtrEquality’
    it is a hidden module in the package ‘containers-tests-0’
    it is a hidden module in the package ‘containers-0.6.6’
    it is a hidden module in the package ‘containers-0.6.5.1’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
    |
254 | import Utils.Containers.Internal.PtrEquality
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.

#893 seems related but it's not merged and when I cherry-pick it, cabal repl still fails like shown above, and:

$ cabal exec -- ghci  containers/src/Data/Set/Internal.hs 
Loaded package environment from /home/waldmann/projekte/containers/dist-newstyle/tmp/environment.-53205/.ghc.environment.x86_64-linux-9.2.5
GHCi, version 9.2.5: https://www.haskell.org/ghc/  :? for help

containers/src/Data/Set/Internal.hs:17:2: error:
     fatal error: containers.h: No such file or directory

I am using

$ cabal --version
cabal-install version 3.8.1.0
compiled using version 3.8.1.0 of the Cabal library 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions