<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I think Simon has a point. I really do not enjoy creating a new throwaway project for every small reproducer I want to test.</blockquote>

</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">My (clearly faulty) mental model is this.  <br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><ul><li>I have a particular stage2 compiler, say $(GHC).  Maybe built in my build tree, maybe installed.</li><li>If I say `$(GHC) -package primitive`, it right says "I don't know about primitiver"</li><li>I expect to be able to say `cabal install primitive --with-compiler=$(GHC)`, to extend my $(GHC) with the package `primitive`.</li><li>Thereafter I expect `$(GHC) -package primitive` to work -- after all, I have extended GHC to  know about it.</li></ul><div>If I'm in a cabal project then these installed-by-default packages shouldn't make any difference; cabal will control everything.</div><div><br></div><div>I'm sure it used to be like this, but something has changed, and I'm not sure why.</div><div><br></div><div>Clearly my model of cabal is faulty, but I don't know how to get an accurate one.  Is there a writeup I can read?  e.g. What is the "environments" file?  Why does it fail to find Prelude?  <br></div><div><br></div><div>
Would it be possible to support the simple story above, as well?  <br></div><div><br></div><div>Simon<br></div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 9 Jul 2024 at 13:23, Sebastian Graf <<a href="mailto:sgraf1337@gmail.com" target="_blank">sgraf1337@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Simon, Hi Matt,</div><div><br></div><div>I think Simon has a point. I really do not enjoy creating a new throwaway project for every small reproducer I want to test.</div><div>A cabal project means that I can't simply pass `-fforce-recomp -ddump-simpl -O` to a GHC invocation, for example. </div><div>Instead I have to create a cabal file and remember all the fields that need to be set. (Or <enter> myself through a perceived 30 step wizard with `cabal new`, only to find that I have to open the file anyway to tweak build-depends...)</div><div><br></div><div>Stupid as it may be, that subconsciously really affects my willingness to tackle an issue.</div><div><br></div><div>Presumably this can be solved through some amount of automation/scripting. Perhaps it would be enough to share these scripts in a prominent location, for example the Wiki.</div><div>Alternatively, I think I would enjoy something like `nix-shell -p`, where I can just fire up a temporary shell with all the deps in a locally visible package db. That way I could keep calling `ghc` directly.<br></div><div><br></div><div>(Not that I suffer <i>much</i> from this issue at the moment anyway.)</div><div><br></div><div>Sebastian<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Di., 9. Juli 2024 um 11:21 Uhr schrieb Matthew Pickering <<a href="mailto:matthewtpickering@gmail.com" target="_blank">matthewtpickering@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">`cabal install --lib` is very hard to use properly. I would advise against it.<br>
<br>
It is much easier to create a simple cabal project and use normal<br>
cabal build commands. I packaged things in a repo for you.<br>
<br>
<a href="https://github.com/mpickering/t25064" rel="noreferrer" target="_blank">https://github.com/mpickering/t25064</a><br>
<br>
```<br>
cabal build -w ghc-9.6.2 (fails)<br>
cabal build -w /path/to/devel/compiler (fails with error message)<br>
```<br>
<br>
Matt<br>
<br>
On Tue, Jul 9, 2024 at 9:58 AM Simon Peyton Jones<br>
<<a href="mailto:simon.peytonjones@gmail.com" target="_blank">simon.peytonjones@gmail.com</a>> wrote:<br>
><br>
> Friends<br>
><br>
> I'm trying to repro #25064 with my development build of GHC.  The test case depends on packages `primitive` and `hashtables`.  So I try this (see below).<br>
><br>
> Alas, apparently after the `cabal install`, it can't find Prelude.<br>
><br>
> What should I do?  I tried removing the "environments" file, whatever that is, which then meant it could find Prelude -- but the libraries were no longer installed.<br>
><br>
> I lack a decent model of what is going on with installing packages for my development builds.   Is there a write up anywhere?<br>
><br>
> Thanks<br>
><br>
> Simon<br>
><br>
><br>
> bash$ cabal install --lib hashtables primitive --with-compiler $HOME/code/HEAD/$s2<br>
> Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.10.1.0 supports<br>
> 'ghc' version < 9.8): /home/simonpj/code/HEAD/_build/stage1/bin/ghc is version<br>
> 9.11.20240517<br>
> Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.10.1.0 supports<br>
> 'ghc' version < 9.8): /home/simonpj/code/HEAD/_build/stage1/bin/ghc is version<br>
> 9.11.20240517<br>
> Resolving dependencies...<br>
> bash$  ~/code/HEAD/$s2 -c T25064.hs<br>
> Loaded package environment from<br>
> T25064.hs:1:8: error: [ ]8;;<a href="https://errors.haskell.org/messages/GHC-87110" rel="noreferrer" target="_blank">https://errors.haskell.org/messages/GHC-87110</a> \GHC-87110 ]8;; \]<br>
>     Could not load module ‘Prelude’.<br>
>     It is a member of the hidden package ‘base-4.20.0.0’.<br>
>     Use -v to see a list of the files searched for.<br>
>   |<br>
> 1 | module Bug where<br>
>   |        ^^^<br>
><br>
> bash$ rm /home/simonpj/.ghc/x86_64-linux-9.11.20240517/environments/default<br>
> bash$ ~/code/HEAD/$s2 -c T25064.hs<br>
> T25064.hs:3:1: error: [ ]8;;<a href="https://errors.haskell.org/messages/GHC-61948" rel="noreferrer" target="_blank">https://errors.haskell.org/messages/GHC-61948</a> \GHC-61948 ]8;; \]<br>
>     Could not find module ‘Control.Monad.Primitive’.<br>
>     Perhaps you meant Control.Monad.Writer (from mtl-2.3.1)<br>
>     Use -v to see a list of the files searched for.<br>
>   |<br>
> 3 | import Control.Monad.Primitive<br>
>   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
><br>
> T25064.hs:4:1: error: [ ]8;;<a href="https://errors.haskell.org/messages/GHC-87110" rel="noreferrer" target="_blank">https://errors.haskell.org/messages/GHC-87110</a> \GHC-87110 ]8;; \]<br>
>     Could not find module ‘Data.HashTable.ST.Basic’.<br>
>     Use -v to see a list of the files searched for.<br>
>   |<br>
> 4 | import qualified Data.HashTable.ST.Basic as H<br>
>   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
><br>
><br>
> _______________________________________________<br>
> ghc-devs mailing list<br>
> <a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></div>
</blockquote></div>