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

cabal new-repl without a project #5425

Closed
int-index opened this issue Jul 11, 2018 · 4 comments
Closed

cabal new-repl without a project #5425

int-index opened this issue Jul 11, 2018 · 4 comments
Assignees

Comments

@int-index
Copy link
Collaborator

int-index commented Jul 11, 2018

Sometimes I just need to check a couple of things in GHCi, not specific to any project. I could run ghci, but then I don't get access to any packages except the ones that are installed globally.

With stack I can run stack ghci --package lens, for instance.

With cabal I have to create something like this:

cabal-version: 2.2
name: global
version: 0

library
  build-depends: base, lens
  default-language: Haskell2010

and then run cabal new-repl in a directory with this .cabal-file.

I'd prefer to write cabal new-repl --package lens:

  • it would find a suitable build plan for the specified packages and launch GHCi in this environment
  • it would not create dist-newstyle in the current directory, instead it could use ~./cabal/dist-global or similar
@int-index
Copy link
Collaborator Author

int-index commented Jul 11, 2018

another possible syntax:

cabal global repl --build-depends "lens, aeson"

maybe we could add other commands in the future to the global namespace, e.g. cabal global build, cabal global run, etc, but let's focus on the REPL for now.

@hvr
Copy link
Member

hvr commented Jul 11, 2018

@int-index you can try https://github.com/hvr/cabal-env for now, which is supposed to be a UI prototyping sandbox for what a possible UI for cabal could be.

Your use-case is handled by

cabal-env -i lens aeson

Once we've gained enough experience with the cabal-env prototype we can start merging it into cabal proper. However, I'm not fully satisfied with cabal-env right now; I still need to implement a few more modes and try them out; this is also related to @typedrat's new-install work which implements a small subset of cabal-env for the library-install use-case.

PS: I don't like the cabal global idea to denote forcing a project-less context; My plan was rather to have cabal --project-file='' repl ... (or maybe some sugar flag, cabal --no-project repl ...) tell cabal to ignore any project context (i.e. ignore any cabal.project or *.cabal file in fs-scope).

@int-index
Copy link
Collaborator Author

@hvr thank you, cabal-env indeed works well for my needs. Looking forward to having this functionality in cabal.

@hvr
Copy link
Member

hvr commented Jul 11, 2018

@int-index btw, please feel free to suggest enhancements to cabal-env; it's really supposed to be a playground for UI experimentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants