[Haskell-community] [Haskell-cafe] technical thoughts on stack

Michael Snoyman michael at snoyman.com
Mon Sep 26 13:42:58 UTC 2016


On Mon, Sep 26, 2016 at 4:36 PM, Sean Leather <sean.leather at gmail.com>
wrote:

> Hi Michael,
>
> On Mon, Sep 26, 2016 at 12:32 PM, Michael Snoyman wrote:
>
>> 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:
>>
>>     export PATH=`stack path --bin-path`
>
>
> 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:
>
>     $ stack path --bin-path
>     Run from outside a project, using implicit global project config
>     Using resolver: lts-7.0 from implicit global project's config file:
> ~/.stack/global-project/stack.yaml
>     Fetched package index.
>     Populated index cache.
>     No compiler found, expected minor version match with ghc-8.0.1
> (x86_64) (based on resolver setting in /Users/leather/.stack/global-
> project/stack.yaml).
>     Try running "stack setup" to install the correct GHC into
> ~/.stack/programs/x86_64-osx/
>
> The above took nearly 10 minutes and failed. I would not recommend doing
> that in a ~/.bashrc.
>
> See https://github.com/commercialhaskell/stack/issues/2325 for the issue
> I reported in July.
>
> Regards,
> Sean
>

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.

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-community/attachments/20160926/3655b4e6/attachment.html>


More information about the Haskell-community mailing list