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

Allow "sandbox without project file" functionality in new Cabal. #3730

Closed
danidiaz opened this issue Aug 29, 2016 · 5 comments
Closed

Allow "sandbox without project file" functionality in new Cabal. #3730

danidiaz opened this issue Aug 29, 2016 · 5 comments

Comments

@danidiaz
Copy link
Collaborator

For quick and dirty exploratory programming —usually when testing new versions of packages— I sometimes create a cabal sandbox in a folder, and then install the desired packages, without bothering to create a cabal file. I then use cabal exec to gain access to the packages.

cabal sandbox init
cabal install transformers-0.5.2.0
...
cabal exec -- ghci

It would be nice if the new Cabal supported something similar to this. Of course, a possible workaround is to create a dummy project.

@ezyang
Copy link
Contributor

ezyang commented Aug 29, 2016

Thank you for the report. Do you just want GHCi, or do you need the full generality of exec?

If you do cabal new-repl at the top-level of a project (#3659), today, something very goofy happens. Maybe this is what should happen in that case. It might have to be annoyingly special-cased, however, since the current new-repl relies on a Setup script for knowing how to repl a Cabal project. Maybe we can just add a new codepath for it.

CC @dcoutts

@danidiaz
Copy link
Collaborator Author

danidiaz commented Aug 29, 2016

Do you just want GHCi, or do you need the full generality of exec?

The great majority of times I have used it for GHCi.

I did have an old use case in which I used cabal exec in combination with --sandbox-config-file to fix a package environment for a number of scripts that were run with runhaskell or compiled with ghc. Here is the repo. I later added a cabal file though.

@danidiaz
Copy link
Collaborator Author

danidiaz commented Aug 31, 2016

I wouldn't mind having to write something like a cabal.config file with the required modules (or even a minimal Setup file) I just would like to avoid having to name a project and specify other project-related stuff at from the outset, while I'm just tinkering.

@dcoutts
Copy link
Contributor

dcoutts commented Sep 4, 2016

I think the .ghc.environment stuff that I'm adding will cover this use case, since you'll be able to just run ghci anywhere in the project and get an environment that includes all the deps of the things in the project. And once we get the "extra-packages" thing in the project file working too then that should cover it.

We could also make cabal repl when not in any package dir do the equivalent.

@phadej
Copy link
Collaborator

phadej commented Feb 13, 2019

Currently one can cabal new-repl -b transformers --constraint=transformers==0.5.2.0 outside the project.

-b could accept package-identifiers to make new-repling with a specific package version more convinient, but that would be separate issue.

@phadej phadej closed this as completed Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants