<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 26, 2016 at 4:36 PM, Sean Leather <span dir="ltr"><<a href="mailto:sean.leather@gmail.com" target="_blank">sean.leather@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Hi Michael,</div><div class="gmail_extra"><span class=""><br><div class="gmail_quote">On Mon, Sep 26, 2016 at 12:32 PM, Michael Snoyman wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>For those wanting to have direct access to GHC and other such tools, without needing to prefix calls with `stack exec -- `, the following added to your ~/.bashrc (or equivalent) will do the trick:</div><br>    export PATH=`stack path --bin-path`</blockquote></div><br></span>This is not the side-effect-free function I expected it to be. I just tried it on a Mac after a new install of stack:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra"><div class="gmail_extra">    $ stack path --bin-path</div><span class=""><div class="gmail_extra">    Run from outside a project, using implicit global project config</div></span><div class="gmail_extra">    Using resolver: lts-7.0 from implicit global project's config file: ~/.stack/global-project/stack.<wbr>yaml</div><div class="gmail_extra">    Fetched package index.</div><div class="gmail_extra">    Populated index cache.</div><div class="gmail_extra">    No compiler found, expected minor version match with ghc-8.0.1 (x86_64) (based on resolver setting in /Users/leather/.stack/global-<wbr>project/stack.yaml).</div><div class="gmail_extra">    Try running "stack setup" to install the correct GHC into ~/.stack/programs/x86_64-osx/</div><div><br></div><div>The above took nearly 10 minutes and failed. I would not recommend doing that in a ~/.bashrc.<br></div><div><br></div></div><div class="gmail_extra">See <a href="https://github.com/commercialhaskell/stack/issues/2325" target="_blank">https://github.com/<wbr>commercialhaskell/stack/<wbr>issues/2325</a> for the issue I reported in July.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Regards,</div><div class="gmail_extra">Sean</div></div></div>
</blockquote></div><br></div><div class="gmail_extra">That's a fair point, but if the user first runs `stack setup` (which I'd recommend in any usage of this line), it does become side-effect-free. Regarding #2325: it might make sense to have `stack path` simply fail if no project file is found, but user intent is a bit unclear on that point.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Michael</div></div>