cleaner stack.yaml?

55 views
Skip to first unread message

Charles

unread,
Aug 30, 2016, 3:02:55 PM8/30/16
to haskell-stack
Hi. I wonder if the stack.yaml generated from stack new could look like this:

    resolver: lts-6.14
    packages:
    - '.'
    extra-deps: []
    flags: {}
    extra-package-dbs: []

Perhaps all the comments would be better placed in the documentation rather than the file?

Harendra Kumar

unread,
Aug 30, 2016, 3:18:28 PM8/30/16
to Charles, haskell-stack
The comments provide new users (and sometimes even to experienced ones) a handy reference. Though they might be a nuisance for someone who is more or less familiar with the config syntax. I agree when you have just a few relevant lines there and too many comments it becomes hard to find what you are looking for. Unfortunately we have two conflicting goals here.

Some products (e.g. vagrant) use an explicit option to generate a clean comment free config file to solve this problem. Experts can always choose to use that option and we can still help the newbies with verbose comments.

-harendra


--
You received this message because you are subscribed to the Google Groups "haskell-stack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stack+unsubscribe@googlegroups.com.
To post to this group, send email to haskel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-stack/fb5b4d7c-c089-4f92-aa5b-a39ff081abab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon Michael

unread,
Aug 31, 2016, 4:50:07 PM8/31/16
to haskel...@googlegroups.com
I learned some useful things from that boilerplate just this morning,
and hopefully will do so again as features change.

How about the clean minimal version at top, followed by the docs link
and useful examples in an easily-removed block at the end ?

Emanuel Borsboom

unread,
Aug 31, 2016, 5:46:29 PM8/31/16
to Simon Michael, haskel...@googlegroups.com
Vagrant's `vagrant init --minimal` option was the first thing that jumped to my mind as well, although Simon Michael's approach sounds fine to me as well.  I think it's worth opening an issue at https://github.com/commercialhaskell/stack/issues/new

--
You received this message because you are subscribed to the Google Groups "haskell-stack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stac...@googlegroups.com.

To post to this group, send email to haskel...@googlegroups.com.

Adam Bergmark

unread,
Sep 2, 2016, 10:07:39 AM9/2/16
to Harendra Kumar, Charles, haskell-stack
I was going to ask about this too. It shouldn't be the default, but an option to remove *stuff* would prevent me from having to delete it each after each stack init :-)

/Adam


Dan Burton

unread,
Sep 2, 2016, 10:07:43 AM9/2/16
to Harendra Kumar, Charles, haskell-stack
I would like for there to be a flag that generates a minimal stack.yaml:
* remove all comments
* remove all fields that are explicitly set to values that are the default anyways (e.g. empty flags, empty extra-defs)

I'd like this flag both for `stack new` as well as `stack init`. I think leaving the verbose default is fine, but my personal preference is to only put something in stack.yaml if it deviates from the default.

-- Dan Burton

Bryan Richter

unread,
Sep 2, 2016, 10:16:48 AM9/2/16
to haskell-stack
On Tue, Aug 30, 2016 at 09:20:00PM -0700, Dan Burton wrote:
> I would like for there to be a flag that generates a minimal
> stack.yaml:
> * remove all comments
> * remove all fields that are explicitly set to values that are the
> default anyways (e.g. empty flags, empty extra-defs)
>
> I'd like this flag both for `stack new` as well as `stack init`. I
> think leaving the verbose default is fine, but my personal
> preference is to only put something in stack.yaml if it deviates
> from the default.

+1

But I'd also rather have the default yaml be bare-bones, since in the
lifetime of my usage of stack, I'll only appreciate the verbose yaml
once[1]. It would be great if there was maybe just a link to an
example yaml one could download or copy if desired. I'd happily take a
1-2 line comment in my "minimal" yaml if it meant it could be the
default format.

[1] Harendra posits this isn't the case, and that sometimes even
experienced users can benefit from the reference. I'd much much rather
have a link to http://haskellstack.org/ as my "reference", rather than
a bunch of different versions of out-of-date "references" scattered
across my projects.
signature.asc

Harendra Kumar

unread,
Sep 2, 2016, 11:57:24 AM9/2/16
to haskell-stack
On 2 September 2016 at 19:46, Bryan Richter <b...@chreekat.net> wrote:

But I'd also rather have the default yaml be bare-bones, since in the
lifetime of my usage of stack, I'll only appreciate the verbose yaml
once[1]. It would be great if there was maybe just a link to an
example yaml one could download or copy if desired. I'd happily take a
1-2 line comment in my "minimal" yaml if it meant it could be the
default format.

[1] Harendra posits this isn't the case, and that sometimes even
experienced users can benefit from the reference. I'd much much rather
have a link to http://haskellstack.org/ as my "reference", rather than
a bunch of different versions of out-of-date "references" scattered
across my projects.

I do not have strong opinions on this. I do like the clean config file and I guess most people will start getting annoyed by the comments at some point. In fact I add 'acme-box-0.0.0.0'  to 'extra-deps' and then use 'stack solver --update-config' to clean the config :-)

The biggest benefit is for beginners, experts would not need to use the reference most of the time. As you suggested, a possible compromise is to put a link at the top. I would want it to be a full syntax cheatsheet instead of a sample stack.yaml. The cheatsheet can have examples of all alternate syntaxes for each field and each field can be a hyperlink to the relevant section in the guide for more details. It can be presented in a much more readable way compared to the comments in stack.yaml.

-harendra

Reply all
Reply to author
Forward
0 new messages