• Stars
    star
    233
  • Rank 172,230 (Top 4 %)
  • Language
    Haskell
  • License
    MIT License
  • Created over 9 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Project templates for stack new

Project templates for Stack

From Stack 1.9.1, Stack allows any GitHub, GitLab or Bitbucket repository named stack-templates to provide project templates for Stack. For example, a template file at username/stack-templates/my-template.hsfiles on GitHub can be identified as username/my-template when using stack new. For more information see the output of the stack templates command and its documentation.

This repository provides the project template new-template, which is the default template used by stack new. It also provides STACK_HELP.md, which specifies the output of the stack templates command.

This repository is the default one used by Stack and it provides 24 other project templates. Information about some of those templates is included in template-info.yaml and this repository's Wiki.

Those project templates are maintained but this repository is not accepting new templates because of the difficulties in maintaining large numbers of templates centrally.

This repository's Wiki provides a place where the Haskell community can announce the availability of project templates at other locations.

Project template format

Each project template is specified in an .hsfiles file, using the syntax of the Mustache tool.

Each file to be generated by the project template is specified with START_FILE, like this:

{-# START_FILE {{name}}.cabal #-}
name:                {{name}}
version:             0.1.0.0
...

Parameters to the template are written {{foo}}. They are provided by users via their Stack config.yaml file, like this:

templates:
  params:
    author-email: [email protected]
    author-name: Chris Done
    copyright: 2022 Chris Done
    github-username: chrisdone
    category: Development

When the user runs stack new my-project username/your-template and they do not have the parameters provided in their Stack config.yaml, Stack will warn the user that such parameters were missing, like this:

Downloading template username/your-template to create project my-project in
directory my-project/ ...
Downloaded <path_to_username/your-template.hsfiles>.

Note: The following parameters were needed by the template but not provided:
      author-email, and author-name.

      You can provide them in Stack's global YAML configuration file
      (<path_to_config.yaml>) like this:

      templates:
        params:
          author-email: value
          author-name: value

      Or you can pass each one on the command line as parameters like this:

      stack new my-project username/your-template -p "author-email:value"
      -p "author-name:value"

The output of the template will yield a blank space where your parameter was. If you want to provide default values for your template parameters, use this Mustache syntax:

author:              {{author-name}}{{^author-name}}Author name here{{/author-name}}

Related initiatives

The repository https://github.com/prikhi/stack-templatizer (unconnected with this repository) provides Haskell source code to build an application that will generate an .hsfiles file from the contents of a folder.

Yesod templates

The Yesod templates are generated from the yesod-scaffold repo. Please send pull requests for those templates to that repository instead of this one.

More Repositories

1

stack

The Haskell Tool Stack
Haskell
3,995
star
2

rio

A standard library for Haskell
Haskell
839
star
3

stackage

Stable Haskell package sets: vetted consistent packages from Hackage
Dockerfile
529
star
4

commercialhaskell

A special interest group for companies and individuals interested in commercial usage of Haskell
452
star
5

haskelldocumentation

Repository for collaborative Haskell documentation
Haskell
209
star
6

lts-haskell

LTS Haskell build plans
Shell
159
star
7

jump

Jump start your Haskell development
158
star
8

haskellers

haskellers.com site
Haskell
141
star
9

path

Typed filepath
Haskell
123
star
10

stackage-server

Server for stable, curated Haskell package sets
Haskell
106
star
11

stack-ide

Stack-based JSON interface to ide-backend
Emacs Lisp
98
star
12

describe

Describe Haskell code in GHCi
PowerShell
72
star
13

casa

Content Addressable Storage Archive
Haskell
41
star
14

pantry

Haskell
39
star
15

all-cabal-hashes

A repository containing all cabal files, with added metadata for package hashes
21
star
16

stackage-snapshots

LTS Haskell and Stackage Nightly snapshot configurations (experimental, for pantry)
Haskell
14
star
17

stackage-content

Content for the stackage.org site
HTML
10
star
18

stackage-nightly

Collection of bundle files for Stackage Nightly builds
10
star
19

all-cabal-metadata

Current metadata for all cabal files
Shell
9
star
20

curator

Haskell Stackage curator build tool
Haskell
8
star
21

all-cabal-files

A repository containing all of the cabal files for all public Haskell packages
8
star
22

state-of-haskell

State of Haskell survey
4
star
23

all-cabal-tool

Update the various all-cabal-* repos
Haskell
4
star
24

hi-file-parser

Haskell
4
star
25

http-download

Haskell
3
star
26

sig-service

Signing service for easily uploading/downloading signatures to the signature index at sig-archive
Haskell
3
star
27

commercialhaskell.com

Codebase for commercialhaskell.com
HTML
3
star
28

sig-tool

Tool for signing, verifying and installing signed packages from sig-archive
Haskell
2
star
29

rio-prettyprint

Haskell
2
star
30

core-cabal-files

Cabal files for packages that ship with GHC but aren't present on Hackage
2
star
31

all-cabal-metadata-tool

Tool for extracting metadata on all packages
1
star
32

stackage-constraints

1
star
33

all-cabal-hashes-tool

Tool for creating the all-cabal-hashes repository
Haskell
1
star
34

devops

Smarty
1
star