There are multiple ways to achieve this:

1) The env command being discussed is actually "stack exec env". Though it includes the full environment rather than stack exclusive. You can use "stack path" to print the stack exclusive environment. You can also use "stack path --<flag>" to pick specific items from that env.

2) Using "stack exec bash" is a very convenient way as suggested by Christopher Allen.

3) But I prefer to just use "export PATH=$(stack path --bin-path)" instead which only sets the PATH. The full environment (when using env or bash) also includes GHC_PACKAGE_PATH which cabal does not like. So if you want to use cabal on stack installed ghc just setting PATH works fine.

I think stack has a lot of flexibility and features, in fact too many. Usually there is already a way to achieve something that you want. Though there are areas where the user experience can be made better including cosmetic stuff like not throwing confusing or unnecessary warnings.

-harendra


On 14 September 2016 at 01:32, Christopher Allen <cma@bitemyapp.com> wrote:
I almost never (maybe twice in the last year) do this, but when I need
an environment that has Stack provided GHC-stuff in the path, I use
`stack exec my-shell`.



On Tue, Sep 13, 2016 at 2:55 PM, Brandon Allbery <allbery.b@gmail.com> wrote:
>
> On Tue, Sep 13, 2016 at 3:47 PM, Richard Eisenberg <rae@cs.brynmawr.edu>
> wrote:
>>
>> Other minor points:
>> `stack env` does not work for me: my version of stack does not know how to
>> `env`
>
>
> I think they said that was an add-in. IIRC stack is extensible with external
> commands, in roughly the same way git is.
>
> (I am also not fond of stack, and even less fond of the politics that go
> with it, but will stick to the technical here.)
>
> --
> brandon s allbery kf8nh                               sine nomine associates
> allbery.b@gmail.com                                  ballbery@sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.



--
Chris Allen
Currently working on http://haskellbook.com
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.