<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Thanks, Michael, for repeating this here. (I'm not on Twitter, as you may have figured out.)</div><div class=""><br class=""></div><div class="">So, as I understand it, I could use the procedure below to install a "system GHC", which could then be filled out with libraries by either `cabal install xxx` or `stack install xxx`.</div><div class=""><br class=""></div><div class="">If this is indeed the case, I will expect to recommend stack to my students next semester, along with instructions of how to modify their PATHs. I'd also be happy to reconsider recommending stack as the one option on a downloads page, if we include the PATH updating instructions.</div><div class=""><br class=""></div><div class="">With regard to `stack exec`: If I modify my PATH to allow direct calls to ghc(i) and then create a project with a stack.yaml, won't `stack exec` use the local settings, etc., when I'm in a subdirectory of the project? At the bottom of your email, it sounds like you're recommending not modifying my PATH, instead always using `stack exec` for a better experience. But it seems to me that modifying my path allows me to skip the `stack exec` outside of projects while still retaining the nice behavior inside of projects, a net win to my eyes. (Your opinion on this may differ, of course.) Is there something I'm missing here?</div><div class=""><br class=""></div><div class="">(Sidenote: You used `stack build` where I expected `stack install` in your gist. I understand that the latter copies executables somewhere and the former does not, but then it seems that the binaries are available in `stack path --bin-path`, so I'm a bit confused.)</div><div class=""><br class=""></div><div class="">Thanks again for your input here!</div><div class="">Richard</div><div class=""><br class=""></div><div class="">
<div class="">-=-=-=-=-=-=-=-=-=-=-<br class="">Richard A. Eisenberg<br class="">Asst. Prof. of Computer Science<br class="">Bryn Mawr College<br class="">Bryn Mawr, PA, USA<br class=""><a href="http://cs.brynmawr.edu/~rae" class="">cs.brynmawr.edu/~rae</a></div>

</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Sep 26, 2016, at 6:32 AM, Michael Snoyman <<a href="mailto:michael@snoyman.com" class="">michael@snoyman.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I just realized that I had shared this answer on Twitter, but not on this mailing list.<div class=""><br class=""></div><div class="">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 class="">    export PATH=`stack path --bin-path`<div class=""><br class=""></div><div class="">This can go as far as providing a means of using cabal-install, for example:</div><div class=""><br class=""></div><div class=""><a href="https://gist.github.com/snoyberg/959a2ade4287de6129910eeabec1d9d2" class="">https://gist.github.com/snoyberg/959a2ade4287de6129910eeabec1d9d2</a><br class=""></div><div class=""><br class=""></div><div class="">For those without an established workflow, or open to experimenting with new workflows, I'd still recommend sticking with `stack exec -- ` in general, since it composes nicely with projects, letting you automatically switch to different GHC versions and package sets. But this is certainly another option to consider.</div></div><div class="gmail_extra" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""><div class="gmail_quote">On Tue, Sep 13, 2016 at 9:58 PM, Richard Eisenberg<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:rae@cs.brynmawr.edu" target="_blank" class="">rae@cs.brynmawr.edu</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">I’ve watched the recent back-and-forth about stack with quite a bit of interest (as many of us have). The discussion inspired me to take another look at stack. Here are the results of that foray.<br class=""><br class="">First, a disclosure: While I have appreciated the emergence of a new build tool for Haskell, I have never much liked stack. One of my chief goals in taking another look is to understand better why I do not like it.<br class=""><br class="">My task: Set up a Haskell environment on a new machine (a Mac). This machine has no Haskell infrastructure on it.<br class=""><br class="">My approach:<br class=""><br class="">1. `brew install haskell-stack`. Success.<br class=""><br class="">At this point, I do not have a Haskell project I wish to build. Instead, I really just want the ability to run Haskell expressions in GHCi. So I skip `stack new` and go straight to<br class=""><br class="">2. `stack setup`. This succeeds, but prints out some interesting messages along the way, including<br class=""><br class="">> Did not find .cabal file for servant-yaml-0.1.0.0 with Git SHA of 71c0a55d0a877954d9590e285c0eb8<wbr class="">61ace2d8cc<br class="">> Right Nothing<br class=""><br class="">At the end, I am helpfully told<br class=""><br class="">> To use this GHC and packages outside of a project, consider using:<br class="">> stack ghc, stack ghci, stack runghc, or stack exec<br class="">><br class=""><br class="">So I then<br class=""><br class="">3. `stack ghci`. My computer’s first reaction is to say<br class=""><br class="">> Run from outside a project, using implicit global project config<br class="">> Using resolver: lts-6.17 from implicit global project's config file: /home/rae/.stack/global-<wbr class="">project/stack.yaml<br class="">> Error parsing targets: The specified targets matched no packages.<br class="">> Perhaps you need to run 'stack init'?<br class="">> Warning: build failed, but optimistically launching GHCi anyway<br class="">><br class=""><br class="">which doesn’t make me feel all that comfortable, but then I am indeed delivered to the GHCi prompt, which works as expected.<br class=""><br class="">Done with GHCi, I quit. I then want to double-check which version of GHC I got, so I<br class=""><br class="">4. `stack ghc --version`. This command reports<br class=""><br class="">> Invalid option `--version’<br class=""><br class="">Grumble. It seems I can’t interact with GHC directly.<br class=""><br class="">————<br class=""><br class="">At this point, I am reminded why I dislike stack:<br class=""><br class="">**It’s optimized for a different workflow than I use.**<br class=""><br class="">And I think this fact (repeated by others’ experiences) is why a segment of our community has not celebrated stack as much as other segments have. We all have different workflows.<br class=""><br class="">From what I understand about it, stack is great for a project-based workflow. In this workflow, you are working on a Haskell project. You are happy to specify settings in .cabal and stack.yaml files. And you really want your build to work in the future and on other machines.<br class=""><br class="">In my experience, stack is not great with a compiler-based workflow. In this workflow, you aren’t quite as organized perhaps and do not have all your settings written. You also want the ability just to compile a file without changing any configurations. You want to be able to start GHCi with a nice set of libraries with which to experiment.<br class=""><br class="">I definitely like a compiler-based workflow. I’m sure that many of you prefer a project-based workflow.<br class=""><br class="">The great news here is that we have a choice: use stack for a project-based workflow, and don’t use it when you want a compiler-based workflow. No one needs to convince others about personal preferences.<br class=""><br class="">But there is one nagging issue: what do we suggest to newcomers? The downloads page right now is not serving us well. (I was legitimately scratching my head at first trying to figure out how to provision a new computer.) Sadly, I don’t see a good option presenting itself. Both potential approaches (The Haskell Toolchain vs. stack) have (in my opinion) serious shortcomings.<br class=""><br class="">A. The Haskell Toolchain (that is, what’s currently called the Haskell Platform Minimal) does appear to lack a “here’s what you do first” tutorial. Forgive me if I’ve missed it. It’s also right now quite hard to discover — you have to choose the oft-maligned Haskell Platform link before you are told that there is a minimal variant.<br class=""><br class="">B. stack sets up GHC in a way that either 1) requires a project-based workflow with a stack.yaml file or 2) issues a bunch of somewhat-scary warnings every time GHC is invoked outside of a project. Furthermore, stack prohibits direct interaction with GHC (as in `ghc --version`).<br class=""><br class="">There’s more good news here! Both of these problems are really easy to fix.<br class=""><br class="">To fix (A), someone just has to write the tutorial.<br class=""><br class="">To fix (B), stack just needs a new option so that `stack setup` installs a system GHC. Perhaps it would even be sufficient for `stack setup` to clearly tell the user where ghc is installed and what to add to their PATH.<br class=""><br class="">I also think, if readers agree with my conclusions about workflows, we should consider writing up criteria that potential users should consider when choosing what workflow to start with. We’ll need to have a tighter recommendation for those with no experience programming, but most developers should be able to recognize what workflow they prefer and choose accordingly.<br class=""><br class="">Of course, there’s a bit of bad news: If both (A) and (B) are fixed, then we’ll really be in a quandary about which installation procedure to put first. Perhaps we should incentivize fixing (A) and (B) by saying whichever one happens first gets to be featured first on the page? :)<br class=""><br class="">So: Does my characterization of workflows resonate? Have I perhaps identified part of the burning black heart of the reason behind the vitriol of late? Should we fix (A) and (B)?<br class=""><br class="">I’m looking forward to hearing your thoughts.<br class=""><br class="">Richard<br class=""><br class=""><br class="">-=-=-=-=-=-=-=-=-=-=-<br class="">Richard A. Eisenberg<br class="">Asst. Prof. of Computer Science<br class="">Bryn Mawr College<br class="">Bryn Mawr, PA, USA<br class=""><a href="http://cs.brynmawr.edu/~rae" rel="noreferrer" target="_blank" class="">cs.brynmawr.edu/~rae</a><br class=""><br class="">______________________________<wbr class="">_________________<br class="">Haskell-Cafe mailing list<br class="">To (un)subscribe, modify options or view archives go to:<br class=""><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank" class="">http://mail.haskell.org/cgi-<wbr class="">bin/mailman/listinfo/haskell-<wbr class="">cafe</a><br class="">Only members subscribed via the mailman list are allowed to post.</blockquote></div></div></div></blockquote></div><br class=""></body></html>