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

Sven Panne svenpanne at gmail.com
Tue Sep 13 20:24:43 UTC 2016


2016-09-13 21:07 GMT+02:00 Theodore Lief Gannon <tanuki at gmail.com>:

> Stack *does* allow direct interaction with GHC:
>
> stack exec -- ghc version
>
> Granted this lacks a bit in brevity, but if you want to issue multiple
> commands from "inside" stack's private environment, you can also just do
> this:
>
> stack exec sh
>

Another option is setting up simple 2-liners like

   #!/bin/sh
   stack --resolver=lts-6.17 exec ghc -- "$@"

and put them under some sensible name (e.g. ghc-7.10.3) into one's ~/bin,
same for ghci. This way you can still keep things nicely separated and in a
known state, but still have access to several versions without typing
overhead. There are still a few tiny annoying things, though:

   * There's the "Run from outside a project blah blah" line, and I don't
see a way to disable that. This is only a cosmetic issue, but still...

   * On Windows under  a MinGW bash you get a a warning for ghci:

        $ stack --resolver=nightly-2016-07-01 exec ghci -- --version
        Run from outside a project, using implicit global project config
        WARNING: GHCi invoked via 'ghci.exe' in *nix-like shells
(cygwin-bash, in particular)
                 doesn't handle Ctrl-C well; use the 'ghcii.sh' shell
wrapper instead
        The Glorious Glasgow Haskell Compilation System, version 8.0.1

     But using ghcii.sh through stack doesn't work:

        $ stack --resolver=nightly-2016-07-01 exec ghcii.sh -- --version
        Run from outside a project, using implicit global project config

D:\Benutzer\Sven\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\bin\ghcii.sh:
createProcess: invalid argument (Exec format error)

   * I've seen variations of "Did not find .cabal file for
servant-yaml-0.1.0.0 with Git SHA of 71c0a55d...", too, and I don't have a
clue what stack is trying to tell me, either. The message should either be
suppressed or improved. As it is, it's useless for the end-user.

   * From time to time I'd like to remove old stuff which has been
installed by stack, e.g. "everything not belonging to the latest LTS" or
"everything from nightly-2016-07-01". I can easily blow away the whole
~/.stack directory and re-download/compile only the new stuff I need, but
there must be a better way, I hope. This kind of housekeeping is really
necessary when you play around a bit with various versions (resulting in
tons of GB in ~/.stack) and your relatively small laptop HDD is getting a
bit full

In a nutshell: I'm quite happy with stack, but it still needs some
polishing. When this is done, it can probably make both the "ad hoc" camp
and the "multi-GHC-version project/library writer" camp happy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-community/attachments/20160913/8bd31dc2/attachment.html>


More information about the Haskell-community mailing list