-
Notifications
You must be signed in to change notification settings - Fork 697
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
cabal init will relocate and rename project structure #8787
Comments
to be clear, I think this new behavior is pretty reasonable, just surprising. (and I did kinda like how interactive cabal init would use the preexisitng project structure as hinting) |
Is it easily recoverable? Does a simple command suffice to get it where it was (other than git reset --hard)? Was any data lost? Asking just in case. |
no data was lost, but editor state was very confused because i did have open buffers on all those files that suddenly weren't there. and DVCS tooling could totally salvage the state of affairs. or just a directory mv/rename |
I guess what i'm trying to say is "cabal should not clobber stuff that isn't cabals". like i'm quite happy to use |
Hello @cartazio, indeed changing folder structure can be stressing. I tried (
I don't see — e.g. — my |
@cartazio wrote:
This would also be my expectation: I write some Haskell code, and then cabalize it. So The new So the new Since old and new This path was not taken, so we just have one |
@ffaf1 i always use cabal interactive init. And I have that reflected in my ~/.cabal/config. I also set it to be recent cabal version flavored. |
@andreasabel thanks for adding some context! It occurs to me that at least for how I always use cabal init (interactive mode), it should be possible to use the oracular power of interaction to ask the user if cabal-install should guess the default config choices based on the existing prject structure. |
Just as @ffaf1, reading the bug report I fail to discern what exactly went wrong. @cartazio can you explain in a bit more detail what you had in the directory, what you did and what you ended up having in the directory. That would increase chances of at least estimating how much effort it would take to make you a happier user of |
I’ll do a better job of giving a reproducible example later this morning.
Very reasonable and I can see it might be tricky without a teeny bit extra
info
…On Tue, Feb 21, 2023 at 11:23 AM Artem Pelenitsyn ***@***.***> wrote:
Just as @ffaf1 <https://github.com/ffaf1>, reading the bug report I fail
to discern what exactly went wrong. @cartazio
<https://github.com/cartazio> can you explain in a bit more detail what
you had in the directory, what you did and what you ended up having in the
directory. That would increase chances of at least estimating how much
effort it would take to make you a happier user of cabal init with cabal
3.8+.
—
Reply to this email directly, view it on GitHub
<#8787 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAABBQXP3GC7MSTCBJZQFCDWYTTXLANCNFSM6AAAAAAVBKQYJY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
ok, so it looks like theres actually a prompt that says "would you like to overwrite files" in the interactive ux that I didnt notice because its new: edit: i have heres a transcript of how to repro stuff that should show that
|
the important bit that snuck up on me was the workflow failure itself would look like
|
I'm honestly confused as to what's the issue here.
This is a bit of a mischaracterization of the history of My and Patrick's work invented nothing new. It cleaned up the codebase and clarified the idea that was already present: 99% of the time you want to build a project and just get going on typing (see also: Let's be clear here tho: I don't care about the 0.01% case. In any other ecosystem, you'd be told you're SOL and go find an old sourceforge copy of a compiler that supports it, along with a copy of the build tool, and emulate your own windows XP enviornment to get it building. The fact that we're even deigning to support extremely old, unmaintained code listed without a .cabal file or at least a stack.yaml is, frankly, a waste of time. |
So the short answer here is: interactive and noninteractive exist because of historical reasons, and while we did propose something like |
to be clear: my use case is to upgrade/modernize a cabalized project's Which maybe is something that could be done as its own tool once the I'd be more than happy to explore leveraging |
a simple near term UX tweak could be as simple as changing the line any color of paint on the bike shed will protect the steel from the elements (or naive readers). |
In terms of UX this is sub-optimal:
The paint is full of lead. |
Lead paint is only dangerous if you eat or inhale it. And the former only happens because lead acetate actually tastes sweet. This metaphor doesn’t scale. Point being: it’s a new question in the interactive mode and it doesn’t give any hinting for what it’ll clobber. |
The problem with such "general permission" questions is that the user does not know what they will be buying themselves with either answer. So they have to try out both choices, and hopefully make their own backup first. The pain in this is that they will have to answer the other dozen question again in the same way on the second try. The best UI will in such cases present the user with concrete plans to choose from. So it will say which files will get moved where, which files be created, which files overwritten. Not sure if there is a design pattern for this, but if there isn't I call it 3P: plan/present/proceed.
It is important that step 4 does not take any further decisions (which would be unauthorized by the user). If you want to think about it in terms of programming languages: The plan language is a mini DSL, the wizard |
That’s a really nice encapsulation of how to maybe structure these things.
I’m not sure how well cabal-installs architecture currently lends itself to
that. But I like the idea.
…On Fri, Feb 24, 2023 at 4:02 AM Andreas Abel ***@***.***> wrote:
Do you wish to overwrite existing files (backups will be created) (y/n)?
[default: n]
The problem with such "general permission" questions is that the user does
not know what they will be buying themselves with either answer. So they
have to try out both choices, and hopefully make their own backup first.
The pain in this is that they will have to answer the other dozen question
again in the same way on the second try.
The best UI will in such cases present the user with *concrete* plans to
choose from. So it will say *which files will get moved where, which
files be created, which files overwritten*.
Not sure if there is a design pattern for this, but if there isn't I call
it *3P: plan/present/proceed*.
1. Gather information (here: from what is on disk, what the user
answers).
2. Create a value in a datatype of IO actions: the plan.
3. Read the plan out to the user and confirm.
4. Execute the plan by interpreting the plan in a suitable interpreter
of IO actions.
It is important that step 4 does not take any further decisions (which
would be unauthorized by the user).
If you want to think about it in terms of programming languages: The plan
language is a mini DSL, the wizard cabal init creates a program in this
DSL, prints it to the user, and then executes it if confirmed. The
granularity of the plan/DSL can be chosen suitably to not flood the user
with tons of details. Or the reading out of the plan could be parametrized
by a verbosity level.
—
Reply to this email directly, view it on GitHub
<#8787 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAABBQSSB5YRW4MBSV3XEZLWZB2KRANCNFSM6AAAAAAVBKQYJY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Fair point Andreas, I look forward to your PR. |
Describe the bug
cabal init MOVEs preexisting data
To Reproduce
cabal fetch
$anything on hackage
cabal init
Expected behavior
i expect (as in previous to cabal-install 3.8 or perhaps even much longer ago), that cabal init uses the preexisting project structure as hinting to suggest directory convention and what not. And not touch code if something already exists.
I do not expect that cabal init to MOVE/RENAME preexisting directories.
I expect cabal init to only clobber a preexisting
.cabal
file, and maybe LICENSE file. I'm not sure honestly. But i was definitely surprised by the moving.why did i do cabal init on a preexisting code base
I wanted to generate a more modern
.cabal
file for a project!The text was updated successfully, but these errors were encountered: