Cabal user-config

I use relude as Prelude alternative in my projects.
So my cabal files look like:

    build-depends:    base ^>=4.18
                    , relude ^>=1.2

    mixins:           base hiding (Prelude)
                    , relude (Relude as Prelude)
                    , relude

Is is possible to set some sort of user configuration in cabal to automatically configure my .cabal files like this one when I run cabal init? I’d like to set some default-extensions as well.

I played a little with cabal user-config but it seems there is no means of doing that.

Another question :slight_smile:
Is there any tool I can call from commad line to add a package in my project’s .cabal file (maybe with version bounds) such that I can type in something like cabal add time aeson and I get my .cabal file updated like this?

    build-depends:    base ^>=4.18
                    , relude ^>=1.2
                    , time ^>=1.12
                    , aeson ^>=2.2
3 Likes

For the latter question, check

Which can be called through cabal via External commands.

Cool,

It’s what I was looking for! :smile:

As regards the first question, does no one need some sort of custom cabal configuration for cabal init?

I think cabal init should be outsourced to a standalone tool, for example summoner. Unfortunately, that is no longer maintained, so my pull request to update it to newer GHC/Stack/Cabal versions has been stuck on GitHub for a long time.

Edit: thanks to @tomjaguarpaw my pull request has been merged and it will hopefully be uploaded to hackage in a few weeks.

3 Likes

I am an assistant maintainer for Kowainik and I can merge this. Could you please respond on the PR to the question I raised?

1 Like