~kaction/cookiecutter-haskell

e3280711dcf095337cdb6076844dd85bc1234f4b — Dmitry Bogatov 1 year, 5 months ago 7d97273
Drop "use_hpack" configuration option

hpack is so much better is any way than obscure "cabal" format, I don't know
why would anybody would prefer raw "cabal".
5 files changed, 0 insertions(+), 45 deletions(-)

M ci.nix
M cookiecutter.json
M hooks/post_gen_project.py
M {{cookiecutter.project_name}}/default.nix
D {{cookiecutter.project_name}}/{{cookiecutter.project_name}}.cabal
M ci.nix => ci.nix +0 -2
@@ 1,5 1,4 @@
{
  use_hpack ? "no",
  add_executable_section ? "no"
}:



@@ 16,7 15,6 @@ rec {
    mkdir "$out"
    cookiecutter \
      --no-input --output-dir "$out" ${./.} \
      use_hpack="${use_hpack}" \
      add_executable_section="${add_executable_section}"
  '';


M cookiecutter.json => cookiecutter.json +0 -1
@@ 5,6 5,5 @@
  "module": "{{cookiecutter.project_name|title|replace('-', '')}}",
  "author_name": "Your Name",
  "gh_user": "your_github_username",
  "use_hpack": ["no", "yes"],
  "add_executable_section": ["no", "yes"]
}

M hooks/post_gen_project.py => hooks/post_gen_project.py +0 -2
@@ 2,8 2,6 @@ import os
import sys

REMOVE_PATHS = [
    '{% if cookiecutter.use_hpack == "yes" %} {{ cookiecutter.project_name }}.cabal {% endif %}',
    '{% if cookiecutter.use_hpack == "no" %} package.yaml {% endif %}',
    '{% if cookiecutter.add_executable_section == "no" %} app/Main.hs {% endif %}',
    '{% if cookiecutter.add_executable_section == "no" %} app {% endif %}',
]

M {{cookiecutter.project_name}}/default.nix => {{cookiecutter.project_name}}/default.nix +0 -2
@@ 26,8 26,6 @@ let
      pkgs.haskellPackages.ghcid
      pkgs.haskellPackages.ormolu
      pkgs.haskellPackages.hlint
      {% if cookiecutter.use_hpack == "yes" %}pkgs.haskellPackages.hpack
      {% endif -%}
      pkgs.niv
      pkgs.nixpkgs-fmt
    ];

D {{cookiecutter.project_name}}/{{cookiecutter.project_name}}.cabal => {{cookiecutter.project_name}}/{{cookiecutter.project_name}}.cabal +0 -38
@@ 1,38 0,0 @@
cabal-version:       3.0

name:                {{cookiecutter.project_name}}
synopsis:            {{cookiecutter.project_synopsis}}
version:             0.0.1.0
homepage:            https://github.com/{{cookiecutter.gh_user}}/{{cookiecutter.project_name}}
license:             BSD-3-Clause
author:              {{cookiecutter.author_name}}
maintainer:          {{cookiecutter.author_name}}
copyright:           {{cookiecutter.author_name}}
category:            {{cookiecutter.category}}
build-type:          Simple

library
  hs-source-dirs:      src
  default-language:    Haskell2010
  exposed-modules:     {{cookiecutter.module}}
  ghc-options:         -Wall -fno-warn-name-shadowing
  build-depends:       base >= 4.11 && < 5

{% if cookiecutter.add_executable_section == "yes" %}executable {{cookiecutter.project_name}}
  main-is:            Main.hs
  hs-source-dirs:     app
  default-language:   Haskell2010
  ghc-options:        -threaded -O2
  build-depends:      base
                    , {{cookiecutter.project_name}}

{% endif -%}
test-suite {{cookiecutter.project_name}}-tests
  type:             exitcode-stdio-1.0
  hs-source-dirs:   test
  main-is:          Main.hs
  default-language: Haskell2010
  ghc-options:      -Wall -threaded
  build-depends:    base >=4.11 && < 5
                  , {{cookiecutter.project_name}}
                  , hedgehog