A collection of project templates for the Stack Haskell build tool.
Templates are written in the hsfiles format leveraging Mustache syntax for placeholder substitution. However, the Stack templating mechanism offers limited support for sharing common parts between templates. As a result, each template is independent, and changes to shared content must be manually updated in every template.
To create a new project based on one of these templates run
stack <options> new <project-name> alessandrocandolini/<name of the corresponding hsfile>assuming stack is installed in the system. Here, <options> is any command-line option available for stack, <project-name> is the name of the project that will be created and <name of the corresponding hsfile> is the name of a hsfile in this repo. For example,
stack new hello-world alessandrocandolini/cli-template
or
stack --resolver nightly-2020-12-12 new hello-world alessandrocandolini/cli-template
Refer to Stack templates documentation for more information on how to provide and use templates, and to the official stack documentation for a comprehensive list of available options when running stack.
Generates a simple CLI application with command-line arguments parsed using optparse-applicative. Tests are written using HSpec with automatic test discovery powered by hspec-discover. By default, several general-purpose libraries are included (e.g., aeson for json parsing, neat-interpolation for multi-line support and string interpolation, etc.).
Generates a basic Servant server running on wai. The server includes a single health check endpoint:
GET /status
It returns a hardcoded 200 response:
{"status":"ok"}
A simple test is also generated to verify the health check implementation.
The template also includes libraries similar to those in the cli-template.
A specialized variant of cli-template specifically designed for Advent of Code projects.
To enable the GitHub Actions CI in the generated project to automatically upload test coverage reports, make sure to set the CODECOV_TOKEN environment variable in the GitHub repository settings. To do this, navigate to Settings > Secrets and variables > Actions > New repository secret. The token can be found under Setting > Global Upload Token