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

Add cabal packages #4493

Open
angerman opened this issue May 4, 2017 · 8 comments
Open

Add cabal packages #4493

angerman opened this issue May 4, 2017 · 8 comments

Comments

@angerman
Copy link
Collaborator

angerman commented May 4, 2017

I would like to propose that cabal learns about packages or new-packages, as a wrapper around ghc-pkg. The motivation here, is that one needs to use only a single command, and not need to know about ghc-pkg.

I'd like to see:

cabal packages [--global|--local]

where

cabal packages --global

would be

ghc-pkg list --package-db=$HOME/.cabal/store/ghc-VERSION/package.db

and

cabal packages --local

would be

ghc-pkg list --package-db=dist-newstyle/packagedb

I'm not sure if no flag should be permitted, and which of both scenarios it would be, or if it should list global AND local.


Slightly unrelated, but why do we have package.db for global and packagedb for local?

@23Skidoo
Copy link
Member

23Skidoo commented May 4, 2017

Probably better to add cabal new-exec so that you could do cabal new-exec ghc-pkg, like you can with sandboxes.

@angerman
Copy link
Collaborator Author

angerman commented May 4, 2017

@23Skidoo that would still require me to understand that there is ghc-pkg, and what it does. I'm coming from a "do not make me think" point of view.

Assuming I'm new to haskell. I kind of know there is ghc, and I heard there is cabal and stack, (I might by accident also have heard of tinc and mafia). For whatever reason I chose to use cabal. I still can't make sense of Cabal, cabal-install and cabal. What's all this? But I'll ignore this for now. I've just been told to run cabal init and cabal (new-)build, and maybe cabal (new-)repl.

To me, the leap from cabal (new-)build to cabal (new-)exec ghc-pkg, is rather big, I need to know I want ghc-pkg, what is this? Why do I need this? And then I need to run cabal (new-)exec, why do I need to do this? All I want is a list of all globally or locally installed packages.

And cabal --help would likely not list cabal (new-)exec ghc-pkg...

If this line of thought runs counter to cabal's philosophy so be it. I'm likely not acquainted enough with the ways of the cabal yet.

@23Skidoo
Copy link
Member

23Skidoo commented May 4, 2017

All I want is a list of all globally or locally installed packages.

There's a cabal list --installed command, you may want to look into adding new-list.

@hvr
Copy link
Member

hvr commented May 6, 2017

@23Skidoo ...wasn't the recommended way to use ghc-pkg in sandboxes via

cabal sandbox hc-pkg        [FLAGS] [--] COMMAND [--] [ARGS]

...

hc-pkg:
  Similar to `ghc-pkg`, but for the sandbox package database. Can be used to
  list specific/all packages that are installed in the sandbox. For
  subcommands, see the help for ghc-pkg. Affected by the compiler version
  specified by `configure`.

@hvr
Copy link
Member

hvr commented May 6, 2017

@angerman naming nitpick: I'm not sure cabal packages --global displaying the store packages is properly named; in the new-build paradigm, we have 3 package dbs, there is the global package db (where e.g. base resides; in other contexts such packages are also called "preinstalled"), the store-cache package db (can get rather huge and can easily contain multiple versions/instances of the same package), and then the local/inplace package db.

@23Skidoo
Copy link
Member

23Skidoo commented May 6, 2017

@hvr Yep, right, because it can use a non-default ghc version.

@gbaz
Copy link
Collaborator

gbaz commented Aug 28, 2021

is this obseleted by new build or handled by #7500 ?

@fgaz
Copy link
Member

fgaz commented Aug 28, 2021

or by cabal env list #6481 for GHC environments (since the user is no longer exposed to package dbs)

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

6 participants