<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">So if you are admixing new-*<br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">commands and other commands for the time being, jumping between the<br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">two, or admixing ghc and ghcjs, etc., then you may run into unexpected<br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">behavior! <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">The simplest solution for now is to delete the local</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">.ghc.environment file in those cases</span></span></blockquote><div><br></div><div>Is `cabal exec` suitable for working around this issue?<br>If not, is there something like `cabal new-exec` planned for the future?</div><input name="virtru-metadata" type="hidden" value="{"email-policy":{"state":"closed","expirationUnit":"days","disableCopyPaste":false,"disablePrint":false,"disableForwarding":false,"expires":false,"isManaged":false},"attachments":{},"compose-window":{"secure":false}}"><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">-- Dan Burton</div></div>
<br><div class="gmail_quote" style="">On Sat, May 12, 2018 at 1:41 PM, Gershom B <span dir="ltr"><<a href="mailto:gershomb@gmail.com" target="_blank">gershomb@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There is an important change in the cabal new- commands for 2.2 that<br>
the release docs should have highlighted more significantly.<br>
<br>
Cabal new-* commands now produce a .ghc.environment file by default.<br>
These files [1] are picked up by ghc and ghci automatically (since<br>
8.0.1), and allow them to operate directly with the same package<br>
environment used by the new-* commands. This lets you, for example,<br>
run `ghci` in a project where you are using `new-build` and get the<br>
proper dependencies in scope. Herbert has written an experimental tool<br>
to make it easier to create and manipulate these environments [2].<br>
<br>
However: there is a drawback (on which some discussion at [3] and [4].<br>
In particular, there is not good information provided by ghc about<br>
when these files are picked up and used. So if you are admixing new-*<br>
commands and other commands for the time being, jumping between the<br>
two, or admixing ghc and ghcjs, etc., then you may run into unexpected<br>
behavior! [5] The simplest solution for now is to delete the local<br>
.ghc.environment file in those cases (i.e. where you're mixing<br>
commands and get unexpected behavior). A particular gotcha is that<br>
these files are picked up not just in the current directory but also<br>
in any parent directory.<br>
<br>
Cheers,<br>
Gershom<br>
<br>
<br>
[1] documented at<br>
<a href="https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/packages.html#package-environments" rel="noreferrer" target="_blank">https://downloads.haskell.org/<wbr>~ghc/latest/docs/html/users_<wbr>guide/packages.html#package-<wbr>environments</a><br>
[2] <a href="https://github.com/hvr/cabal-env" rel="noreferrer" target="_blank">https://github.com/hvr/cabal-<wbr>env</a><br>
[3] <a href="https://github.com/haskell/cabal/issues/4542" rel="noreferrer" target="_blank">https://github.com/haskell/<wbr>cabal/issues/4542</a><br>
[4] <a href="https://ghc.haskell.org/trac/ghc/ticket/13753" rel="noreferrer" target="_blank">https://ghc.haskell.org/trac/<wbr>ghc/ticket/13753</a><br>
[5] Error messages may be like<br>
".cabal/store/ghc-8.0.2/<wbr>package.db/package.cache: openBinaryFile: does<br>
not exist (No such file or directory)" or complaints about missing<br>
inplace dependencies.<br>
______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div><br></div></div>