commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
4k stars 843 forks source link

`stack repl` doesn't work on project with `mixins` #5077

Open chshersh opened 5 years ago

chshersh commented 5 years ago

General summary/comments (optional)

I have a project that follows the mixins approach of using an alternative prelude. When trying to load the project in GHCi via stack repl, I see multiple defintions not in scope errors. I tried to create a minimal example, but I couldn't. stack works on my small examples even with common stanzas, multiple stanzas, but for some reasons doesn't work on the following packages (however, the build is successful):

Steps to reproduce

  1. git clone git@github.com:kowainik/summoner.git
  2. cd summoner
  3. stack repl summoner

Expected

Successfully entering REPL without compilation errors.

Actual

What actually happened.

If you suspect that a stack command misbehaved, please include the output of that command in --verbose mode. If the output is larger than a page please paste the output in a Gist.

$ stack repl summoner --verbose
Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2
2019-11-07 17:13:10.072378: [debug] Checking for project config at: /home/shersh/haskell/kowainik/summoner/stack.yaml
2019-11-07 17:13:10.072696: [debug] Loading project config file stack.yaml
2019-11-07 17:13:10.082806: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2019-11-06 14:13:10.082744481 UTC]
2019-11-07 17:13:10.083594: [debug] Using package location completions from a lock file
2019-11-07 17:13:10.241257: [debug] Asking for a supported GHC version
2019-11-07 17:13:10.241444: [debug] Installed tools: 
 - ghc-8.8.1
 - ghc-8.6.5
2019-11-07 17:13:10.241578: [debug] Run process: /sbin/ldconfig -p
2019-11-07 17:13:10.243327: [debug] Process finished in 2ms: /sbin/ldconfig -p
2019-11-07 17:13:10.243485: [debug] Found shared library libtinfo.so.5 in 'ldconfig -p' output
2019-11-07 17:13:10.243742: [debug] Did not find shared library libtinfo.so.6
2019-11-07 17:13:10.243809: [debug] Did not find shared library libncursesw.so.6
2019-11-07 17:13:10.243852: [debug] Found shared library libgmp.so.10 in 'ldconfig -p' output
2019-11-07 17:13:10.243913: [debug] Did not find shared library libgmp.so.3
2019-11-07 17:13:10.243938: [debug] Potential GHC builds: standard
2019-11-07 17:13:10.243976: [debug] Found already installed GHC builds: standard
2019-11-07 17:13:10.244150: [debug] SELECT "id","actual_version","arch","ghc_path","ghc_size","ghc_modified","ghc_pkg_path","runghc_path","haddock_path","cabal_version","global_db","global_db_cache_size","global_db_cache_modified","info","global_dump" FROM "compiler_cache" WHERE "ghc_path"=?; [PersistText "/home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-8.6.5"]
2019-11-07 17:13:10.298209: [debug] Loaded compiler information from cache
2019-11-07 17:13:10.298354: [debug] Asking for a supported GHC version
2019-11-07 17:13:10.298530: [debug] Resolving package entries
2019-11-07 17:13:10.298578: [debug] Parsing the targets
2019-11-07 17:13:10.301271: [debug] Checking flags
2019-11-07 17:13:10.301339: [debug] SourceMap constructed
2019-11-07 17:13:10.317484: [debug] Starting to execute command inside EnvConfig
2019-11-07 17:13:10.323804: [debug] Parsing the targets
2019-11-07 17:13:10.324310: [debug] Finding out which packages are already installed
2019-11-07 17:13:10.324757: [debug] Run process: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --global --no-user-package-db dump --expand-pkgroot
2019-11-07 17:13:10.355967: [debug] Process finished in 31ms: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --global --no-user-package-db dump --expand-pkgroot
2019-11-07 17:13:10.357836: [debug] Ignoring package parsec due to wanting version 3.1.14.0 instead of 3.1.13.0
2019-11-07 17:13:10.359674: [debug] Ignoring package Cabal due to wanting version 2.4.1.0 instead of 2.4.0.1
2019-11-07 17:13:10.360008: [debug] Ignoring package haskeline due to wanting version 0.7.5.0 instead of 0.7.4.3
2019-11-07 17:13:10.360314: [debug] Run process: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/shersh/.stack/snapshots/x86_64-linux/fc05c9059930f271da94fa1badc9c441d516cf58762c2d5c2d2f3ecd56b8fe82/8.6.5/pkgdb dump --expand-pkgroot
2019-11-07 17:13:10.419985: [debug] Process finished in 60ms: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/shersh/.stack/snapshots/x86_64-linux/fc05c9059930f271da94fa1badc9c441d516cf58762c2d5c2d2f3ecd56b8fe82/8.6.5/pkgdb dump --expand-pkgroot
2019-11-07 17:13:10.422927: [debug] Run process: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/shersh/haskell/kowainik/summoner/.stack-work/install/x86_64-linux/fc05c9059930f271da94fa1badc9c441d516cf58762c2d5c2d2f3ecd56b8fe82/8.6.5/pkgdb dump --expand-pkgroot
2019-11-07 17:13:10.445716: [debug] Process finished in 23ms: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/shersh/haskell/kowainik/summoner/.stack-work/install/x86_64-linux/fc05c9059930f271da94fa1badc9c441d516cf58762c2d5c2d2f3ecd56b8fe82/8.6.5/pkgdb dump --expand-pkgroot
2019-11-07 17:13:10.446366: [debug] Start: getPackageFiles /home/shersh/haskell/kowainik/summoner/summoner-cli/summoner.cabal
2019-11-07 17:13:10.461316: [debug] Finished in 15ms: getPackageFiles /home/shersh/haskell/kowainik/summoner/summoner-cli/summoner.cabal
2019-11-07 17:13:10.462659: [info] Using main module: 1. Package `summoner' component summoner:exe:summon with main-is file: /home/shersh/haskell/kowainik/summoner/summoner-cli/app/Cli.hs
2019-11-07 17:13:10.462734: [debug] Parsing the targets
2019-11-07 17:13:10.462959: [debug] Checking flags
2019-11-07 17:13:10.462994: [debug] SourceMap constructed
2019-11-07 17:13:10.465141: [debug] Finding out which packages are already installed
2019-11-07 17:13:10.465326: [debug] Run process: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --global --no-user-package-db dump --expand-pkgroot
2019-11-07 17:13:10.499832: [debug] Process finished in 34ms: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --global --no-user-package-db dump --expand-pkgroot
2019-11-07 17:13:10.501418: [debug] Ignoring package parsec due to wanting version 3.1.14.0 instead of 3.1.13.0
2019-11-07 17:13:10.502793: [debug] Ignoring package Cabal due to wanting version 2.4.1.0 instead of 2.4.0.1
2019-11-07 17:13:10.503062: [debug] Ignoring package haskeline due to wanting version 0.7.5.0 instead of 0.7.4.3
2019-11-07 17:13:10.503281: [debug] Run process: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/shersh/.stack/snapshots/x86_64-linux/fc05c9059930f271da94fa1badc9c441d516cf58762c2d5c2d2f3ecd56b8fe82/8.6.5/pkgdb dump --expand-pkgroot
2019-11-07 17:13:10.557785: [debug] Process finished in 54ms: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/shersh/.stack/snapshots/x86_64-linux/fc05c9059930f271da94fa1badc9c441d516cf58762c2d5c2d2f3ecd56b8fe82/8.6.5/pkgdb dump --expand-pkgroot
2019-11-07 17:13:10.560864: [debug] Run process: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/shersh/haskell/kowainik/summoner/.stack-work/install/x86_64-linux/fc05c9059930f271da94fa1badc9c441d516cf58762c2d5c2d2f3ecd56b8fe82/8.6.5/pkgdb dump --expand-pkgroot
2019-11-07 17:13:10.583959: [debug] Process finished in 23ms: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/shersh/haskell/kowainik/summoner/.stack-work/install/x86_64-linux/fc05c9059930f271da94fa1badc9c441d516cf58762c2d5c2d2f3ecd56b8fe82/8.6.5/pkgdb dump --expand-pkgroot
2019-11-07 17:13:10.584556: [debug] Constructing the build plan
2019-11-07 17:13:10.587306: [debug] SELECT "id","directory","type","pkg_src","active","path_env_var","haddock" FROM "config_cache" WHERE "directory"=? AND "type"=?; [PersistText "/home/shersh/haskell/kowainik/summoner/.stack-work/install/x86_64-linux/fc05c9059930f271da94fa1badc9c441d516cf58762c2d5c2d2f3ecd56b8fe82/8.6.5/",PersistText "lib:summoner-1.3.0.1-8yeaPcO00SAHtbTZyLsqZQ"]
2019-11-07 17:13:10.588364: [debug] SELECT "id", "config_cache_id", "index", "option" FROM "config_cache_dir_option" WHERE ("config_cache_id"=?) ORDER BY "index"; [PersistInt64 83]
2019-11-07 17:13:10.588652: [debug] SELECT "id", "config_cache_id", "index", "option" FROM "config_cache_no_dir_option" WHERE ("config_cache_id"=?) ORDER BY "index"; [PersistInt64 83]
2019-11-07 17:13:10.588877: [debug] SELECT "id", "config_cache_id", "ghc_pkg_id" FROM "config_cache_dep" WHERE ("config_cache_id"=?); [PersistInt64 83]
2019-11-07 17:13:10.589048: [debug] SELECT "id", "config_cache_id", "component" FROM "config_cache_component" WHERE ("config_cache_id"=?); [PersistInt64 83]
2019-11-07 17:13:10.589686: [debug] Start: getPackageFiles /home/shersh/haskell/kowainik/summoner/summoner-cli/summoner.cabal
2019-11-07 17:13:10.612952: [debug] Finished in 23ms: getPackageFiles /home/shersh/haskell/kowainik/summoner/summoner-cli/summoner.cabal
2019-11-07 17:13:10.617319: [debug] Checking if we are going to build multiple executables with the same name
2019-11-07 17:13:10.617425: [debug] Executing the build plan
2019-11-07 17:13:10.618384: [debug] Finding out which packages are already installed
2019-11-07 17:13:10.618626: [debug] Run process: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --global --no-user-package-db dump --expand-pkgroot
2019-11-07 17:13:10.653939: [debug] Process finished in 35ms: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --global --no-user-package-db dump --expand-pkgroot
2019-11-07 17:13:10.655305: [debug] Ignoring package parsec due to wanting version 3.1.14.0 instead of 3.1.13.0
2019-11-07 17:13:10.656821: [debug] Ignoring package Cabal due to wanting version 2.4.1.0 instead of 2.4.0.1
2019-11-07 17:13:10.657215: [debug] Ignoring package haskeline due to wanting version 0.7.5.0 instead of 0.7.4.3
2019-11-07 17:13:10.657436: [debug] Run process: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/shersh/.stack/snapshots/x86_64-linux/fc05c9059930f271da94fa1badc9c441d516cf58762c2d5c2d2f3ecd56b8fe82/8.6.5/pkgdb dump --expand-pkgroot
2019-11-07 17:13:10.710565: [debug] Process finished in 53ms: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/shersh/.stack/snapshots/x86_64-linux/fc05c9059930f271da94fa1badc9c441d516cf58762c2d5c2d2f3ecd56b8fe82/8.6.5/pkgdb dump --expand-pkgroot
2019-11-07 17:13:10.713859: [debug] Run process: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/shersh/haskell/kowainik/summoner/.stack-work/install/x86_64-linux/fc05c9059930f271da94fa1badc9c441d516cf58762c2d5c2d2f3ecd56b8fe82/8.6.5/pkgdb dump --expand-pkgroot
2019-11-07 17:13:10.734634: [debug] Process finished in 21ms: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/shersh/haskell/kowainik/summoner/.stack-work/install/x86_64-linux/fc05c9059930f271da94fa1badc9c441d516cf58762c2d5c2d2f3ecd56b8fe82/8.6.5/pkgdb dump --expand-pkgroot
2019-11-07 17:13:10.735172: [debug] Start: getPackageFiles /home/shersh/haskell/kowainik/summoner/summoner-cli/summoner.cabal
2019-11-07 17:13:10.749525: [debug] Finished in 14ms: getPackageFiles /home/shersh/haskell/kowainik/summoner/summoner-cli/summoner.cabal
2019-11-07 17:13:10.751133: [warn] The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
2019-11-07 17:13:10.751213: [info] Configuring GHCi with the following packages: summoner
2019-11-07 17:13:10.751787: [debug] Run process: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-8.6.5 --version
2019-11-07 17:13:10.785282: [debug] Process finished in 33ms: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-8.6.5 --version
2019-11-07 17:13:10.785835: [debug] Run process: /home/shersh/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-8.6.5 --interactive -i -odir=/home/shersh/haskell/kowainik/summoner/.stack-work/odir -hidir=/home/shersh/haskell/kowainik/summoner/.stack-work/odir -hide-all-packages -XDeriveGeneric -XDerivingStrategies -XGeneralizedNewtypeDeriving -XInstanceSigs -XLambdaCase -XOverloadedStrings -XRecordWildCards -XScopedTypeVariables -XTypeApplications -i/home/shersh/haskell/kowainik/summoner/summoner-cli/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build -i/home/shersh/haskell/kowainik/summoner/summoner-cli/src -i/home/shersh/haskell/kowainik/summoner/summoner-cli/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/autogen -i/home/shersh/haskell/kowainik/summoner/summoner-cli/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/global-autogen -stubdir=/home/shersh/haskell/kowainik/summoner/summoner-cli/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build -package-id=base-4.12.0.0 -package-id=relude-0.6.0.0-AcrVfUNryj1HsmpcUfIeuY -package-id=aeson-1.4.5.0-4tP9POulx7kGv2m3BKQ2NN -package-id=ansi-terminal-0.9.1-JvtMBmSUh1eHKvsAMwthXj -package-id=bytestring-0.10.8.2 -package-id=containers-0.6.0.1 -package-id=directory-1.3.3.0 -package-id=filepath-1.4.2.1 -package-id=generic-deriving-1.12.4-DLZ2cqfoVDQGYjceQHrMNL -package-id=gitrev-1.3.1-28bODUJmuLsJT3tLybQkQz -package-id=neat-interpolation-0.3.2.4-HeNnMwiiKFO9lpwTnxIb8W -package-id=optparse-applicative-0.15.0.0-A6eMLcSzmzvDFZhHmBUdaj -package-id=process-1.6.5.0 -package-id=shellmet-0.0.3.0-1SoT2mnycLoBHUzO2p2kwD -package-id=text-1.2.3.1 -package-id=time-1.8.0.2 -package-id=tomland-1.2.1.0-LHNUJPIynQz4eLzzDdfVjr -i/home/shersh/haskell/kowainik/summoner/summoner-cli/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/summon -i/home/shersh/haskell/kowainik/summoner/summoner-cli/app -i/home/shersh/haskell/kowainik/summoner/summoner-cli/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/summon/autogen -i/home/shersh/haskell/kowainik/summoner/summoner-cli/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/summon/summon-tmp -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat -Widentities -Wredundant-constraints -fhide-source-paths -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat -Widentities -Wredundant-constraints -fhide-source-paths -rtsopts -with-rtsopts=-N -optP-include -optP/home/shersh/haskell/kowainik/summoner/.stack-work/ghci/0e95b82b/cabal_macros.h -ghci-script=/tmp/haskell-stack-ghci/513d8b67/ghci-script
GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
[ 1 of 25] Compiling Paths_summoner
[ 2 of 25] Compiling Summoner.Ansi

/home/shersh/haskell/kowainik/summoner/summoner-cli/src/Summoner/Ansi.hs:33:16: error:
    Not in scope: type constructor or class ‘Text’
    Perhaps you meant ‘T.Text’ (imported from Data.Text)
   |
33 | putStrFlush :: Text -> IO ()
   |                ^^^^

/home/shersh/haskell/kowainik/summoner/summoner-cli/src/Summoner/Ansi.hs:55:27: error:
    Not in scope: type constructor or class ‘Text’
    Perhaps you meant ‘T.Text’ (imported from Data.Text)
   |
55 | beautyPrint :: [IO ()] -> Text -> IO ()
   |                           ^^^^

/home/shersh/haskell/kowainik/summoner/summoner-cli/src/Summoner/Ansi.hs:61:14: error:
    Not in scope: type constructor or class ‘Text’
    Perhaps you meant ‘T.Text’ (imported from Data.Text)
   |
61 | prompt :: IO Text
   |              ^^^^

/home/shersh/haskell/kowainik/summoner/summoner-cli/src/Summoner/Ansi.hs:68:13: error:
    Not in scope: type constructor or class ‘Text’
    Perhaps you meant ‘T.Text’ (imported from Data.Text)
   |
68 | boldText :: Text -> IO ()
   |             ^^^^

/home/shersh/haskell/kowainik/summoner/summoner-cli/src/Summoner/Ansi.hs:71:16: error:
    Not in scope: type constructor or class ‘Text’
    Perhaps you meant ‘T.Text’ (imported from Data.Text)
   |
71 | boldDefault :: Text -> IO ()
   |                ^^^^

/home/shersh/haskell/kowainik/summoner/summoner-cli/src/Summoner/Ansi.hs:74:26: error:
    Not in scope: type constructor or class ‘Text’
    Perhaps you meant ‘T.Text’ (imported from Data.Text)
   |
74 | colorMessage :: Color -> Text -> IO ()
   |                          ^^^^

/home/shersh/haskell/kowainik/summoner/summoner-cli/src/Summoner/Ansi.hs:80:75: error:
    Not in scope: type constructor or class ‘Text’
    Perhaps you meant ‘T.Text’ (imported from Data.Text)
   |
80 | errorMessage, warningMessage, successMessage, infoMessage, skipMessage :: Text -> IO ()
   |                                                                           ^^^^
Failed, one module loaded.

<no location info>: error:
    Could not load module ‘Summoner’
    It is a member of the hidden package ‘summoner-1.3.0.1’.
    You can run ‘:set -package summoner’ to expose it.
    (Note: this unloads all the modules in the current scope.)
Loaded GHCi configuration from /tmp/haskell-stack-ghci/513d8b67/ghci-script

Stack version

$ stack --version
Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2

Method of installation

yushyin commented 4 years ago

I have the same problem. It prevents me from using ghcide with stack, because mixins don't work.

Kleidukos commented 4 years ago

Hi! I have the exact same problem with this project. @snoyberg do you have any idea what it could be?

gribouille commented 4 years ago

Same problem for me. cababl new-repl works!

nuttycom commented 4 years ago

I have the same issue. It's a blocker for me using stack on my projects.

jneira commented 4 years ago

I had to change my cleaner mixins stanza for PackageImports + CPP due to this, too

sjakobi commented 4 years ago

I have a bit of time to spend on this issue. Unfortunately I'm neither very familiar with mixins nor with the relevant code in stack.

So far I've created a fairly minimal reproducer for this issue: https://github.com/sjakobi/stack-repl-mixin#readme

What I understand from looking at the way cabal repl invokes ghci, is that the mixin info should be passed in with the -package-id option:

For a package that has

  mixins:              base hiding (Prelude)
                     , relude (Relude as Prelude)

, the invocation looks like this:

ghc --interactive ... -package-id 'base-4.13.0.0 (Control.Applicative, ..., Unsafe.Coerce)' -package-id 'relude-0.7.0.0-a762b0db97a8db7c442717031b276b7c996c29e935fa7b59555e477a6a1a6d3a (Relude as Prelude)'

Notably, the list of base modules excludes Prelude.

On the Cabal side, the mixin info is provided via BuildInfo's mixins field.

In stack, the -package-id options are contained in the bioPackageFlags via the ghciPkgOpts that are generated here:

https://github.com/commercialhaskell/stack/blob/9621945bf7fe6d0a526ee6b6f183d3c821143979/src/Stack/Ghci.hs#L196

So the next step for me would be to figure out how to get the mixins info from Cabal's BuildInfo into the bioPackageFlags.

@snoyberg, @qrilka, does this sound like a reasonable plan of attack? Do you have any advice or pointers for me?

@ezyang, do you have any comments or advice? Does my idea to naively enhance stack's GhciPkgInfo with the mixins info from Cabal's BuildInfo seem likely to work or am I possibly missing some fundamental complication? I was surprised that grepping for mixin in the cabal-install source didn't result in any hits. It appears that cabal-install somehow gets away with any mixins logic being handled in Cabal. I wonder whether there's a more elegant solution for this issue that could similarly rely on Cabal's mixins handling.

My work is on this branch: https://github.com/commercialhaskell/stack/compare/master...sjakobi:sjakobi/5077-repl-mixins

snoyberg commented 4 years ago

I don’t have much to add, but that overall seems like a reasonable approach.

ezyang commented 4 years ago

I need to check if BuildInfo is after Backpack has done mixin linking or not. Naively my expectation is that it will be "easy" to add support for use of mixins that is internal to a library only, and "hard" to add it for mixins that refer to external libraries.

sjakobi commented 4 years ago

I'd like to continue working on this issue soon.

I need to check if BuildInfo is after Backpack has done mixin linking or not.

@ezyang Do you have a pointer for how I could figure this out myself?

I guess https://www.microsoft.com/en-us/research/wp-content/uploads/2016/07/backpack-2016.pdf would be good background reading?!

ezyang commented 4 years ago

@sjakobi OK, I checked, BuildInfo is before mixin linking has happened (it's parsed directly from the Cabal file). However, if there isn't any Backpack involved, then this suggestion:

Does my idea to naively enhance stack's GhciPkgInfo with the mixins info from Cabal's BuildInfo seem likely to work or am I possibly missing some fundamental complication?

Will give you an incorrect but still useful version that will do the right thing for people who aren't actually using Backpack signatures. At least for the original reporter of this bug, their problem will be solved.

If you're interested in full on Backpack, I'd actually probably recommend my thesis for background reading https://github.com/ezyang/thesis/releases

ulidtko commented 7 months ago

Bump. Still an issue.

Apart from Ambiguous module name ‘Prelude’: it was found in multiple packages that this issue causes — there's also GHC bug #10920 that will become a blocking issue afterwards, attempting to use module ‘Prelude’ which is not loaded.

@sjakobi you've apparently gotten a green light to fix this, any success or further findings? I've checked your branch, but there isn't much there.

eeoam commented 2 months ago

Hello - today I tried to use mixins with stack repl and it didn't work so it appears that this is still an open issue (after almost half a decade!). @sjakobi any chance this will be fixed in the near future?