Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to non-interactive init. #5902

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@m-renaud
Copy link
Collaborator

commented Feb 27, 2019

Overview

By default, running cabal init will be performed non-interactively (new) and will default to an executable (existing behaviour). For rationale see #5696, in summary, its much more common to want to create an executable than a library (since each library is by definition depended on by one or more binaries). This also creates a better beginner friendly experience out of the box, allowing them to simply run two commands and have an executable they can hack on right away:

cabal init
cabal run

Getting the old behaviour

Whether or not init is interactive is controlled by a flag in ~/.cabal/config:

init
  -- interactive: False

By changing it to the value below, all init invocations will be interactive (unless -n is passed):

init
  interactive: True

/cc @hvr @23Skidoo @gbaz


Please include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • If the change is docs-only, [ci skip] is used to avoid triggering the build bots.

@m-renaud m-renaud requested a review from 23Skidoo Feb 27, 2019

@m-renaud m-renaud referenced this pull request Feb 27, 2019

Open

Beginner friendly cabal-install CLI #5696

3 of 5 tasks complete
@23Skidoo

This comment has been minimized.

Copy link
Member

commented Feb 27, 2019

/cc @byorgey

@23Skidoo
Copy link
Member

left a comment

Code LGTM.

@byorgey

This comment has been minimized.

Copy link
Member

commented Mar 2, 2019

LGTM too.

@hvr

This comment has been minimized.

Copy link
Member

commented Mar 3, 2019

I'm not happy about this PR; see my comment at #5696 (comment)

@harpocrates

This comment has been minimized.

Copy link
Collaborator

commented Mar 3, 2019

I'm also against this as the default.

Beginners don't usually start by making packages. Even if they do, the current interactive mode isn't that scary; most questions have defaults so it is possible to just "skip" the ones you don't understand (and still end up with something reasonable).

That said, I also want to appreciate how much effort @m-renaud has put into revamping init (even if I don't agree with all those changes).

@23Skidoo

This comment has been minimized.

Copy link
Member

commented Mar 3, 2019

That said, I also want to appreciate how much effort @m-renaud has put into revamping init (even if I don't agree with all those changes).

+1, thanks a lot @m-renaud!

@gbaz

This comment has been minimized.

Copy link
Collaborator

commented Mar 4, 2019

I tend to agree with harpocrates here. The interactive mode holds the hands of beginners through a lot of stuff, and I think it is a good experience. I think that it might be nice to more clearly highlight as part of interactive mode that there is a flag to skip it in the future, to streamline the process for them. But certainly interactive feels more friendly for newcomers, and non-interactive for people that already know what they're doing.

@m-renaud

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 4, 2019

Thanks everyone for the input and for the recognition, it means a lot :) It an attempt to not scatter the discussion too much I've replied to hvr's comment in #5696 (comment) to speak to some of the points he raised as well as bringing in some of the other comments left here to have a more complete picture in one spot.

A few short answers (expanded in the other thread):

@harpocrates : Beginners don't usually start by making packages

I don't think this is true because as soon as you try and do anything non-trivial you need to pull in some packages from hackage since haskell bundles very little in its base library. Also, using the ghc CLI directly is significantly less straightforward than running cabal init && cabal v2-run, if anything I would rather point folks directly to cabal instead of using ghc directly since you don't need to learn anything new when moving from "super simple file" to "a bit more complex/multi-file/depends on packages".

and still end up with something reasonable

If the goal is to end up with something reasonable then not having to do anything and still ending up with something reasonable seems like the base case :)

To speak briefly to a couple of concrete suggestions here:

@gbaz : I think that it might be nice to more clearly highlight as part of interactive mode that there is a flag to skip it in the future

I really like this idea and is something to be done regardless of the outcome of this PR discussion, so I'll put together a PR for that when I get a chance.

I mentioned a poll in the other comment, but wanted to ask again here to see what folks thought. LMK and I can put one together, could also post on various discussion threads to see what other people think.

Lastly, I just want to state that I completely respect whatever decision is made regarding this change, I just want to make sure that the various trade-offs have been thoroughly considered and there is diversity of input. I know the release of cabal 3.0 is coming up very quickly so it would be great to have a decision by then, but if that seems unlikely I'd like to at least make sure docs and suggestions from the tool are updated appropriately to reflect the ability to change the default.

@byorgey

This comment has been minimized.

Copy link
Member

commented Mar 12, 2019

I also added a comment over at #5696 .

@m-renaud

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 4, 2019

Friendly ping :) The PR is marked as blocked on "decision needed", how does this decision get made?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.