<div dir="ltr"><div>Thanks both! <br></div><div><br></div><div>I've updated the doc and replied to your comments Simon. I'll also update the wiki page soon.</div><div><br></div><div>Thanks for summarising Matt! I've copied over your email into the doc.</div><div>I'll also post your suggestion in the cabal ticket. <br></div><div><br></div><div>Cheers,</div><div>Teo</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 8, 2025 at 10:24 AM Matthew Pickering <<a href="mailto:matthewtpickering@gmail.com" target="_blank">matthewtpickering@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 Teo, I went back and read <a href="https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13297" target="_blank">https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13297</a></div><div><br></div><div>I think my comment is a very good summary there. Which I will paste into this thread. <br></div><div><br></div><div>```</div><div><p dir="auto">Why are these packages not re-installable?</p>
<ol dir="auto"><li>
<p>If you are not using the internal interpreter (or dynamic loading at all), then you are free to reinstall any package as long as the resulting package database contains a unit for each of the wired in unit ids which exports the relevant wired-in definitions.</p>
</li><li>
<p>If you are using template-haskell and the internal interpreter, then your program must link against exactly the same version of template-haskell (and dependencies) that the</p>
</li><li>
<p>If you are using plugins, then your program must link against exactly the same version of <code>ghc</code> library (and dependencies)</p>
</li></ol>
<p dir="auto">** Cabal simplifies all of these situations by refusing to reinstall certain packages and always using the global package database **</p>
<ol dir="auto"><li>Cabal refuses to reinstall wired in units and always uses the global package database, therefore the
relevant unit is always available with the correct ABI.</li><li>Cabal refuses to reinstall <code>template-haskell</code>, which forces it to be taken from the global package database, which ensures it is the same version as the compiler is linked against.</li><li>Cabal refuses to reinstall <code>ghc</code> library, which forces it to be taken from the global package database, which ensures the same version of the library is linked against.</li></ol>
<p dir="auto">Therefore I don't think it's accurate for the compiler to advertise in particular which packages are "not reinstallable", as that is not a property of the compiler itself.</p>
<p dir="auto">There is no conceptual barrier to the situation where you want to use <code>template-haskell</code> or <code>ghc</code> library in a situation where you don't want or need to dynamically load code into the running process. In this situation, it would be perfectly permissible to reinstall it and use it in your program. The issue comes that Cabal doesn't allow you to express the constraint that the version of <code>template-haskell</code> you depend on needs to be fixed to the one the compiler is built against. As such, it has to be pessimistic and never reinstall <code>template-haskell</code> or <code>ghc</code>, but against, not an issue in particular with GHC.</p>
<p dir="auto">** Cabal can not express the constraint that a library must be the same version as the one the build compiler is built against **</p><p dir="auto">```</p><p>Your point is that</p><p>* GHC should advertise to Cabal which (template-haskell, ghc) unit it links against. Then cabal should ensure that if TemplateHaskell/plugins are used then it should enforce in the build plan that this version of `template-haskell`/`ghc` is picked. </p><p>My point was</p><p>* GHC can only advertise a unit id, it wasn't clear to me about how to map this information into the cabal solver. <br></p><p>I suppose we will have the assumption that if GHC advertises it is linked against a specific unit id, then that unit will be in a global package database. Cabal already reads the global package database.</p><p>Perhaps the only thing we need to add to the cabal solver is the ability to express a constraint that you depend on a precise unit-id. Then when cabal-install starts the solver it can query GHC to find the unit-ids which need to be fixed, and feed those constraints into the solver. Then if users are feeling very brave, they can turn off this behaviour..</p><p>Thinking aloud here..</p><p>Matt</p><p><br></p><p dir="auto"><br></p><p dir="auto"><br></p><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 2, 2025 at 6:26 PM Teo Camarasu <<a href="mailto:teofilcamarasu@gmail.com" target="_blank">teofilcamarasu@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 folks,</div><div><br></div><div>At Tuesday's GHC devs meeting, we talked about having a discussion about template-haskell stability. I've jotted down some notes to help focus our future discussion. It's mostly just a list of what I take to be the next most important issues to tackle, and some details about each.</div><div><br></div><div><a href="https://docs.google.com/document/d/1gui1YXOvrNihR3NpXuMVCKV3lTkKPL8y_HDRjbZyRxk/edit?usp=sharing" target="_blank">https://docs.google.com/document/d/1gui1YXOvrNihR3NpXuMVCKV3lTkKPL8y_HDRjbZyRxk/edit?usp=sharing</a></div><div><br></div><div>Cheers,</div><div>Teo</div></div>
_______________________________________________<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>