hakyll-init should also produce cabal package files #267

Closed
nagisa opened this Issue Jun 10, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@nagisa
Contributor

nagisa commented Jun 10, 2014

Nowadays, given how popular cabal sandboxes are getting, hakyll-init should also generate site.cabal and Cabal.hs files and use of cabal run and cabal build should be promoted instead of building with GHC manually.

First of all, we should run cabal init-like questionaire minus the “What does the package build:” and “What is the main module of the executable:” questions to which the answers are known (respectively “Executable” and “other”/“site.hs”). Then we should add current Hakyll version to the dependencies in the generated cabal file.

Following cabal init command does almost the right thing:

cabal init --is-executable --main-is=site.hs -d"hakyll >= 4.5.2.0 && < 4.6" -d"base >= 4.6" --language=Haskell2010

The generated cabal file, however, still needs to have ghc-options: -threaded added to it and there appears to be no way to add it with cabal init.

@jaspervdj

This comment has been minimized.

Show comment
Hide comment
@jaspervdj

jaspervdj Jun 12, 2014

Owner

I agree, although I would opt for not shelling out to cabal and using the Cabal library instead. I'm actually not sure if we want to ask any questions to the user -- we can just fill in the config with defaults and he/she can edit it afterwards?

Owner

jaspervdj commented Jun 12, 2014

I agree, although I would opt for not shelling out to cabal and using the Cabal library instead. I'm actually not sure if we want to ask any questions to the user -- we can just fill in the config with defaults and he/she can edit it afterwards?

@nagisa

This comment has been minimized.

Show comment
Hide comment
@nagisa

nagisa Jun 12, 2014

Contributor

Indeed.

The file below is the minimal .cabal file that works and it has so little moving parts (the dependency bounds on hakyll only) that we could just keep this file as a static resource instead of pulling the whole cabal as a dependency. No other files are necessary.

name:                site
version:             0.1.0.0
build-type:          Simple
cabal-version:       >=1.10

executable site
  main-is:             site.hs
  build-depends:       base == 4.*
                     , hakyll == 4.5.*
  ghc-options:         -threaded
  default-language:    Haskell2010

What do you think?

EDIT: otherwise the file above can serve as a good guide for what we aiming to generate with the Cabal library.

Contributor

nagisa commented Jun 12, 2014

Indeed.

The file below is the minimal .cabal file that works and it has so little moving parts (the dependency bounds on hakyll only) that we could just keep this file as a static resource instead of pulling the whole cabal as a dependency. No other files are necessary.

name:                site
version:             0.1.0.0
build-type:          Simple
cabal-version:       >=1.10

executable site
  main-is:             site.hs
  build-depends:       base == 4.*
                     , hakyll == 4.5.*
  ghc-options:         -threaded
  default-language:    Haskell2010

What do you think?

EDIT: otherwise the file above can serve as a good guide for what we aiming to generate with the Cabal library.

@jaspervdj

This comment has been minimized.

Show comment
Hide comment
@jaspervdj

jaspervdj Jun 13, 2014

Owner

Yeah that's great. The only thing I'd change is change site to the argument given to hakyll-init, since usage is hakyll-init my-blog.

Owner

jaspervdj commented Jun 13, 2014

Yeah that's great. The only thing I'd change is change site to the argument given to hakyll-init, since usage is hakyll-init my-blog.

@jaspervdj jaspervdj closed this in 721bdc2 Jun 13, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment