Skip to content
Mike Pilgrem edited this page Jul 17, 2022 · 5 revisions

Welcome to the stack-templates wiki! This wiki is intended to provide access to information about common Stack project templates you may wish to use.

A different approach was taken to Stack project templates before version 1.9.1 of Stack. You can find information on the original templates at:

https://github.com/commercialhaskell/stack-templates/blob/master/template-info.yaml

The templates available from commercialhaskell are the .hsfiles files listed at:

https://github.com/commercialhaskell/stack-templates

Using the templates

The commands below require version 1.9.1 of Stack or later.

If the template identifier is template-id, you can create a project called myproject with command:

stack new myproject template-id

template-id may be a file, URL or remote repository. An example of a template-id that is a remote repository is yesodweb/simple. That will correspond to the URL https://github.com/yesodweb/stack-templates/blob/master/simple.hsfiles.

Simple templates

  • new-template: used by Stack by default, if no alternative template is specified. Provides a package.yaml file, which will be used by Stack's in-built version of Hpack to generate a corresponding .cabal file. Covers an executable (in app/Main.hs), a library and dependency (in src/Lib.hs), and a (not implemented) test executable (in test/Spec.hs).

  • kurt: named after Will Kurt, the author of the 2018 book Get Programming with Haskell. Equivalent to new-template other than it does not provide a package.yaml file but provides a .cabal file directly.

  • simple: Provides only a 'hello world' executable in src/Main.hs. Does not provide a package.yaml file but provides a .cabal file directly.

  • simple-hpack: Equivalent to simple other than it provides a package.yaml file, which will be used by Stack's in-build version of Hpack to generate a corresponding .cabal file.

  • simple-library: Equivalent to kurt other than it does not provide a test executable.

Command line applications

  • rio: provides a library, executable, and test suite based on the rio library. Provides built in logging and command line parsing support.

Web applications

Yesod

Yesod provides many different flavors of its scaffold depending on which database (if any) you wish to use.

  • yesodweb/postgres
  • yesodweb/mysql
  • yesodweb/sqlite
  • yesodweb/mongo
  • yesodweb/simple- no database at all, and no authentication support
  • yesodweb/minimal- bare bones scaffold, also doesn't support yesod devel