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

Welcome to the stack-templates wiki! This Wiki is intended to provide access to information on common templates you may wish to use. We're in the process of converting over to this Wiki from the original stack templates approach used in Stack 1.7 and earlier. You can still find information on the original templates at:

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

Or check out the raw list of templates available from commercialhaskell at:

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

Using the templates

The commands below require stack 1.9. If the template identifier is template-id, you can create a project called myproj with:

$ stack new myproj template-id

template-id may be a file, url or remote repository. For the latter case, an example may be yesodweb/simple, which will correspond to https://github.com/yesodweb/stack-templates/blob/master/simple.hsfiles.

Note: There is currently a bug on Windows which means github templates must be preceded by github: e.g. github:yesodweb/simple.

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 apps

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
Clone this wiki locally