Coder Social home page Coder Social logo

stack-templates's Introduction

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.

License

All the templates in this repository use identifiers from the SPDX License List and all but two specify BSD-3-Clause.

The SPDX expression syntax was first required by the Cabal Package Description Format Specification version 2.2 and that version is specified in template Cabal files. Hpack will also detect that the use of BSD-3-Clause in a template package.yaml file requires cabal-version: 2.2 in a Cabal file.

Stack, however, also supports versions of GHC that come with versions of the Cabal library before Cabal-2.2.0.0. If you are using such versions of GHC, edit the files produced by the template to replace BSD-3-Clause with BSD3 and edit any Cabal files produced by the template to replace cabal-version: 2.2 with cabal-version: >=1.10.

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: 2023 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.

stack-templates's People

Contributors

adamsteen avatar alexanderkjeldaas avatar bitemyapp avatar borsboom avatar chrisdone avatar danburton avatar decentral1se avatar eriknstevenson avatar jpvillaisaza avatar jturner avatar k0kubun avatar kerscher avatar mgsloan avatar mihaimaruseac avatar mpilgrem avatar noelmarkham avatar nrolland avatar nwtgck avatar phadej avatar psibi avatar reinh avatar rikvdkleij avatar seanhess avatar sjakobi avatar snoyberg avatar soenkehahn avatar steshaw avatar tfausak avatar thibauddauce avatar tonyday567 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stack-templates's Issues

ghcjs template does not produce any JavaScript file

Steps I took:

$ stack new ghcjs
$ cd ghcjs
$ stack build

Running find . -type f -iname '*.js' doesn't return any result. I am doing something wrong? I thought templates were supposed to be a complete setup of a project.

Stack version: Version 1.6.3, Git revision b27e629b8c4ce369e3b8273f04db193b060000db (5454 commits) x86_64 hpack-0.20.0

Why is cabal file ignored via .gitignore?

I'm writing a bunch of newbie-friendly tutorials and noticed the following in .gitignore

.stack-work/
exercises.cabal
*~

PS: This is the result of stack init --bare --resolver=9.14 exercises

Any reason why the cabal file is being explicitly ignored? Has this already been discussed before?

Some yesod templates tests fail at first because there's no CSRF middleware

The Handler.Comment specs fail, because of:

https://github.com/commercialhaskell/stack-templates/blob/master/yesod-postgres.hsfiles#L289

Not having:

-    yesodMiddleware = defaultYesodMiddleware
+    yesodMiddleware = defaultYesodMiddleware . defaultCsrfMiddleware

That change is made by this patch:
https://gist.github.com/4821e3ab96615ec4adda6e431ea93411

The other solution is to remove calls to addTokenFromCookie in tests, which seems to be what other yesod templates do.

That change is made by this patch:
https://gist.github.com/4d6a4f7d7ed74a3116d953dec340b359

Opinionated set of warnings by default?

I think a good default set of warnings is -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -fwarn-identitites. Is this too scary to put in a default cabal file? I think it'd be good to call attention to these extra safety warnings, which can be disabled if necessary.

It does, however, mean that the ghc-options field can now get quite large. For example, the test-suite of the default template will have -threaded -rtsopts -with-rtsopts=-N -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -fwarn-identitites

hspec template broken

Using the hspec template I cannot import Test.Hspec

The following steps reproduce the behaviour:

stack new hspec
cd hspec

contents of test/Spec.hs

import Test.Hspec

main :: IO ()
main = hspec $ do
  describe "Prelude.head" $ do
    it "returns the first element of a list" $ do
      head [23 ..] `shouldBe` (23 :: Int)
stack install
stack build
stack test

produces
Failed to load interface for ‘Test.Hspec’ It is a member of the hidden package ‘hspec-2.2.3’. Perhaps you need to add ‘hspec’ to the build-depends in your .cabal file.
but hspec is already in that list.

It probably confuses hspec for the project instead of the hspec dependency.

The same steps work in another template:

stack new my-project
cd my-project
#add hspec to build-depends of my-project.cabal

contents of test/Spec.hs

import Test.Hspec

main :: IO ()
main = hspec $ do
  describe "Prelude.head" $ do
    it "returns the first element of a list" $ do
      head [23 ..] `shouldBe` (23 :: Int)
stack install
stack build
stack test

Tutorial template

Please add a tutorial template. Show how to add packages and do some simple file reading/printing. Demonstrate how to setup a small unit test framework. Take a total beginner (like me) by the hand. Display a message right after installing stack that there is a tutorial waiting.

strange(?) base constraints on yesod-*

I just tried to start a yesod-postgres project with stack (wanted lts-7.10) but the resolver could not choose lts-7.10:

* Rejected lts-7.10
    ghc-8.0.1 cannot be used for these packages:
        - YesodTest
    base version 4.9.0.0 found
        - YesodTest requires >=4.8.2.0 && <4.9 || >=4.9.1.0 && <5
    Using package flags:
        - YesodTest: dev = False, library-only = False

turns out there is this base-constraint in the scaffolded .cabal but of course the base-version on lts-7.10 is base-4.9.0.0

yesod-sqlite template only supports persiting data, but not retriving it?

I've tried out the yesod-sqlite example, and thought it was broken because no mater what I did on the page, upon refresh all my entered data were gone, e.g. comments.

So I started looking into the code, and it seems to me that the yesod-sqlite template was written only to persist data into the database, but never to retrieve it?

https://github.com/commercialhaskell/stack-templates/blob/master/yesod-sqlite.hsfiles#L1064

I am not sure if my quick assessment is correct, could also be some other issue. Is this template supposed to showcase only persisting data without ever retrieving it?

edit: I've checked the database and it does contain the correctly set up schema and some of my comments, but when I navigate to http://localhost:3000 I don't see anything I've entered.

edit 2: I've also ran stack test. Even though the tests are green, reading them I don't see any tests checking if any page served up contains anything persisted.

edit 3 @ 2016-01-18T18:00:14: Okay, managed to make it work!

Wizek/yesod-sqlite@1c3cae3

It might make sense to incorporate something like this into the template, might it not? I'm just beginning to learn Yesod, and it would have saved me a few hours trying to figure out. Having a working example always helps me quite a bit. I imagine it could help others too.

New license selection parameter in ./stack/config.yaml

By default the BSD3 license is mentioned in the generated .cabal file and downloaded automatically.
Would it be possible to add a new parameter to the stack.yaml in order to specify and download another license like MIT or GPLv3?

ghcjs template broken out of the box

running today, with stack --version

Version 0.1.6.0, Git revision e22271f5ce9afa2cb5be3bad9cafa392c623f85c (2313 commits) x86_64

starting a new project with template ghcjs fails. stack can't find a buildplan. i tried stack init --solver in the folder and i get

⚡ 08:23 PM noon ∈ simutron5000@master>stack init --solver                            1 ↵
Writing default config file to: /home/noon/dev/simutron5000/simutron5000/stack.yaml
Basing on cabal files:
- /home/noon/dev/simutron5000/simutron5000/simutron5000.cabal

Asking cabal to calculate a build plan, please wait
Running /home/noon/.cabal/bin/cabal --config-file=/tmp/cabal-solver21621/cabal.config install --enable-tests --enable-benchmarks -v --dry-run --only-dependencies --reorder-goals --max-backjumps=-1 --package-db=clear --package-db=global /home/noon/dev/simutron5000/simutron5000/ exited with ExitFailure 1
'/usr/bin/alex' '--version'
'/home/noon/.cabal/bin/c2hs' '--numeric-version'
'/home/noon/.cabal/bin/cpphs' '--version'
'/usr/bin/gcc' '-dumpversion'
'/usr/local/bin/haddock' '--version'
'/home/noon/.cabal/bin/happy' '--version'
'/usr/local/bin/hpc' 'version'
looking for tool hsc2hs near compiler in /usr/local/bin
found hsc2hs in /usr/local/bin/hsc2hs
'/usr/local/bin/hsc2hs' '--version'
'/home/noon/.cabal/bin/HsColour' '-version'
'/usr/local/bin/ghc' '-c' '/tmp/21640.c' '-o' '/tmp/21640.o'
'/usr/bin/ld' '-x' '-r' '/tmp/21640.o' '-o' '/tmp/21641.o'
'/usr/bin/pkg-config' '--version'
'/bin/tar' '--help'
Reading available packages...
Updating the index cache file...
Choosing modular solver.
Resolving dependencies...

cabal: Could not resolve dependencies:
trying: simutron5000-0.1.0.0 (user goal)
next goal: ghcjs-base (dependency of simutron5000-0.1.0.0)
Dependency tree exhaustively searched.

am i missing something?

A feature for displaying message before completing successfully

With the yesod init command it displayed a beginner friendly message after completing successfully. This functionality is lost now.

I want to suggest how to implement this in stack new. If you like this approach I hope to find time to implement it.

What about having a {-# START_SUCCESS_MESSAGE #-} to signify where the message starts. It think can be a mustache template like anything else. Good approach?

Template should use correct copyright year

Some templates put "copyright 2015" snippets in LICENSE or *.cabal files.

Minimal fix: Should be changed to "2016".
Better fix: Should be computed based on system date at call time of stack new.

Determine guidelines for template inclusion

How do we determine whether a template should be included in this repo?

I don't really want to end up with a huge pile of templates to maintain, where there's an incentive for library authors to add templates in order to make their package more discoverable. In other words, ideally the boilerplate code should be stuff that people will want to modify, rather than just delete. A template should consist of boilerplate which is useful for many projects.

At once, I can see the value of initializing a cabal file with a bunch of dependencies that are commonly used together.

ghcjs template will need update for improved-base

Or maybe a whole new template? I can provide that if it sounds good. The only (current) change is that the IsString instance of JSString moved locations, so Lib.hs needs

- import GHCJS.Foreign ()
+ import Data.JSString ()

Error building servant-docker template project using docker-compose

The servant-docker template seems to be broken, as it fails to build using docker-compose.

Steps to reproduce:

stack new test-project servant-docker
cd test-project
docker-compose up

The build error I'm getting:

Step 5/8 : RUN export PATH=$(stack path --local-bin):$PATH
---> Running in 81444355df0d
Downloading lts-11.11 build plan ...
Downloaded lts-11.11 build plan.
AesonException "Error in $.packages.cassava.constraints.flags['bytestring--lt-0_10_4']: Invalid flag name: "bytestring--lt-0_10_4""

Are there any gui templates such using gtk+

It would be good to eventually enable cross platform applications, in particular Linux to Windows and Mac. It seems a proper GUI template would be a good first step, perhaps capitalizing on existing cross platform frameworks such as GTK+. I am surprise there isn't already such a template. However, I am new to Haskell expect there is a good though unfathomable reason. ;)

Library-only template

Simple and new-template didn't seem to fit the bill. Any opposed to me adding a simple-library?

Servant docker: compiler version mismatch

Using the servant-docker template leads currently to this:

Compiler version mismatched, found ghc-8.2.1 (x86_64), but expected minor version match with ghc-8.0.2 (x86_64) (based on resolver setting in /app/user/stack.yaml).
To install the correct GHC into /root/.stack/programs/x86_64-linux/, try running "stack setup" or use the "--install-ghc" flag.

The cause is the generated Dockerfile is depending on haskell:8:
https://github.com/commercialhaskell/stack-templates/blob/master/servant-docker.hsfiles#L158

The currently recent haskell docker file is in version 8.2.1 and uses ghc 8.2.1:
https://github.com/freebroccolo/docker-haskell/blob/master/8.2/Dockerfile

The template was probably meant to be used with 8.0.x instead, which is using ghc 8.0.2
https://github.com/freebroccolo/docker-haskell/blob/master/8.0/Dockerfile

The simple solution is to depend on haskell:8.0 instead of haskell:8.

Wrong directory names in chrisdone template

Commit d619fbc changed the hs-source-dirs of the executable from src/main to app, and the hs-source-dirs and main-is of the test suite from src/test and Main.hs to test and Spec.hs, respectively. However, the templates app/Main.hs and test/Spec.hs were not changed, they're still src/main/Main.hs and src/test/Main.hs.

Servant template broken out of the box

I created a project from the template

stack new servant servant

then I ran

stack setup

inside the servant directory. However, when I run the following

stack build

I get the following error:

[aaron@localhost servant]$ stack build
While constructing the BuildPlan the following exceptions were encountered:

--  Failure when adding dependencies:    
      servant-server: needed (-any), couldn't resolve its dependencies
    needed for package servant-0.1.0.0

--  Failure when adding dependencies:    
      servant: needed (==0.9.*), couldn't resolve its dependencies
    needed for package servant-server-0.9.1.1

Any ideas why this might be happening? Thank you for your help!

Document opinionated decisions which should be consistent across templates

It would be nice if templates were generally consistent with eachother. For example, #47

From here:

Is there some sort of style guide for the final app? For instance, when specifying the executable, should Main.hs live in app/ or bin/ or exe/ or something else?

Maybe it's user discretion / template author discretion. I like app/ well. src/main/ is nice too, because then all your src is in the same subdir. Stack uses that, but I'm not sure why.

How to get a ghcjs project up & running?

(Possibly related to #15)

I've tried several incantations of stack new ui ghcjs, but failed to get anything to work:

Is the ghcjs stack-template known to not work? Is the recommended way to use stack new --bare and then change stack.yaml to one of the snippets given at https://docs.haskellstack.org/en/stable/ghcjs/ ?

I get some variation of the following output in each case:

$ stack new ui ghcjs
Downloading template "ghcjs" to create project "ui" in ui/ ...

The following parameters were needed by the template but not provided: author-email, author-name, category, copyright, github-username
You can provide them in /Users/saurabhnanda/.stack/config.yaml, like this:
templates:
  params:
    author-email: value
    author-name: value
    category: value
    copyright: value
    github-username: value
Or you can pass each one as parameters like this:
stack new ui ghcjs -p "author-email:value" -p "author-name:value" -p "category:value" -p "copyright:value" -p "github-username:value"

Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- ui/ui.cabal

Downloaded lts-11.13 build plan.    
Downloaded nightly-2018-06-12 build plan.    
Selecting the best among 13 snapshots...

Didn't see massiv-io-0.1.4.0@sha256:5f1e34ec5f0a16c34de82b422f4e20d014b5e5677176a30731d17b5f5ccaa9c3,2300 in your package indices.
Updating and trying again.
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/                                 
Downloading timestamp                                                                            
Downloading snapshot                                                                             
Updating index                                                                                   
Updated package index downloaded                                                                 
Update complete                                                                                  
Populated index cache.    
* Partially matches lts-11.13
    ghcjs-base not found
        - ui requires -any

* Partially matches nightly-2018-06-12
    ghcjs-base not found
        - ui requires -any

* Partially matches lts-10.10
    ghcjs-base not found
        - ui requires -any

* Partially matches lts-9.21
    ghcjs-base not found
        - ui requires -any

* Partially matches lts-8.24
    ghcjs-base not found
        - ui requires -any

* Partially matches lts-7.24
    ghcjs-base not found
        - ui requires -any

* Partially matches lts-6.35
    ghcjs-base not found
        - ui requires -any

* Partially matches lts-5.18
    ghcjs-base not found
        - ui requires -any

* Partially matches lts-4.2
    ghcjs-base not found
        - ui requires -any

* Partially matches lts-3.22
    ghcjs-base not found
        - ui requires -any

* Partially matches lts-2.22
    ghcjs-base not found
        - ui requires -any

* Partially matches lts-1.15
    ghcjs-base not found
        - ui requires -any

* Partially matches lts-0.7
    ghcjs-base not found
        - ui requires -any

Selected resolver: lts-11.13
Resolver 'lts-11.13' does not have all the packages to match your requirements.
    ghcjs-base not found
        - ui requires -any

This may be resolved by:
    - Using '--solver' to ask cabal-install to generate extra-deps, atop the chosen snapshot.
    - Using '--omit-packages to exclude mismatching package(s).
    - Using '--resolver' to specify a matching snapshot/resolver

templates with names identical to packages are broken

To illustrate, one can create a new servant project
stack new servant
And then modify app/Main.hs to import Servant.API. Stack / cabal / ghc will complain that Servant.API was not found. The reason being that the cabal file (relevant bits below) references itself rather than the actual servant package.

Changing the project name from servant to foobar fixes the issue and cabal is able to resolve the dependency.

I'm not sure if this is by design or not but it definitely is confusing. At the very least the template should include a README which explains how the template is meant to be used.

__DATA__
ubuntu@ip-172-31-34-114:~/servant$ cat servant.cabal 
name:                servant
version:             0.1.0.0
synopsis:            Initial project template from stack
...
executable app
  hs-source-dirs:      app
  main-is:             Main.hs
  ghc-options:         -threaded -rtsopts -with-rtsopts=-N
  build-depends:       base
                     , servant
  default-language:    Haskell2010

ServantDocker doesn't work out of the box

tldr;

  1. The Dockerfile needs to inherit from haskell:8.6.3
  2. The project name needs to be lowercased in several instances.

Steps to reproduce:

stack new ServantDockerTest servant-docker

sudo docker-compose up

  1. "ERROR: no such image: ServantDockerTest: invalid reference format: repository name must be lowercase"

I go to docker-compose.yml and change line 3, 5, 15: to servantdockertest


version: '3'
services:
    servantdockertest:
        build: .
        image: servantdockertest
        command: ServantDockerTest
        expose:
            - "1234"
    nginx:
        build: ./nginx
        image: nginx
        ports:
            - "8080:80"
        depends_on:
            - servantdockertest

  1. The build will fail because of ghc mismatch. To get past this, I update the docker image to haskell:8.6.3 or I have to go into the stack.yaml and change the resolver from lts-13.4 to lts-11.8

  2. sudo docker-compose up will still fail because the upstream can't be found. Have to edit the nginx.conf file for the upstream app.

upstream app { server servantdockertest:1234; }

sudo docker-compose build
sudo docker-compose up

And everything works.

Remove yesod-helloworld template

I was the one who added it here. Maintaining this and doing occasional cabal bump is not that pleasant here. A better way to add this template is via the yesod-scaffold repo (which I should have done previously but didn't know at that time!).

'stack new' dies, if some config.yaml value contains colon

Default template was replaced in #112 to hpack. After stack upgrading I couldn't create new project by stack new anymore. But stack new package-name simple works fine for instance. The reason for the issue was a colon : in copyright value in config.yaml

The issue was faced on FreeBSD 11.

steps to reproduce

  • install stack version 1.6.1, Git revision f25811329bbc40b0c21053a8160c56f923e1201b (5435 commits) x86_64 hpack-0.20.0
  • stack/config.yaml content
templates:
  params:
    author-email: '[email protected]'
    author-name: me
    category: value
    copyright: 'Copyright: (c) 2017 A P'
    github-username: me
  scm-init: git
  • run stack new
% stack new --verbose xyz 
Version 1.6.1, Git revision f25811329bbc40b0c21053a8160c56f923e1201b (5435 commits) x86_64 hpack-0.20.0
2017-12-08 15:58:59.267997: [debug] Opening local template: "new-template.hsfiles"
@(Stack/New.hs:148:9)
2017-12-08 15:58:59.268975: [info] Downloading template "new-template" to create project "xyz" in xyz/ ...
@(Stack/New.hs:109:9)
2017-12-08 15:58:59.269158: [debug] Downloading /commercialhaskell/stack-templates/master/new-template.hsfiles
@(Network/HTTP/Download.hs:69:5)
2017-12-08 15:59:05.649364: [debug] Opening local template: "/usr/home/palik/.stack/templates/new-template.hsfiles"
@(Stack/New.hs:148:9)
2017-12-08 15:59:05.651791: [debug] Creating process: /usr/local/bin/git init
@(System/Process/Log.hs:22:3)
Initialized empty Git repository in /tmp/xyz/.git/
2017-12-08 15:59:05.656227: [info] Looking for .cabal or package.yaml files to use to init the project.
@(Stack/Init.hs:74:5)
2017-12-08 15:59:05.656927: [info] Using cabal packages:
@(Stack/Solver.hs:545:5)
2017-12-08 15:59:05.656998: [info] - xyz/

@(Stack/Solver.hs:546:5)
2017-12-08 15:59:05.657080: [debug] Running hpack on /tmp/xyz/package.yaml
@(Stack/PrettyPrint.hs:63:22)
/tmp/xyz/package.yaml:6:30: mapping values are not allowed in this context 

workaround
The issue could be solved by removing of colon in copyright value in config.yaml
copyright: 'Copyright (c) 2017 A P'

Unable to launch Docker container for servant-docker Template out of the box

Hello,

It appears that the servant-docker template contains a template for a docker-compose.yml but no actual Dockerfile defining our API's container to use as the image for the api resource in docker-compose.yml.

Is there a common Dockerfile example we can use to build containers on top of the stack toolchain?

Thanks for any feedback.

yesod-simple I18N

I can't find the internationalization stuff in yesod-simple, why??? I have manage to configure it with persistent-odbc, but messages directory isn't present. Do I need to setup the I18N stuff myself?
Side note: Yesod is really awesome!

bootstrap.js missing in the yesod-sqlite template

This template includes only the bootstrap.css file, so lines like the following doesn't work. This is from the default-layout.hamlet that comes with the template:

<button type="button" .navbar-toggle.collapsed data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">

To solve this in my project I put the following lines in the default-layout-wrapper.hamlet, so it gets the bootstrap from a CDN.

\<!-- Bootstrap CDN -->
\<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

\<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

\<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous">

Don't know if this is a good solution to the template.

yesod-mysql template has broken "Log in with.." links

Clicking "Log in with Google" gives the following screen:

image

Entire error:

StatusCodeException (Status {statusCode = 404, statusMessage = "Not Found"}) [("Content-Type","text/html; charset=utf-8"),("Cache-Control","no-cache, no-store, max-age=0, must-revalidate"),("Pragma","no-cache"),("Expires","Mon, 01 Jan 1990 00:00:00 GMT"),("Date","Tue, 13 Dec 2016 19:59:42 GMT"),("Content-Encoding","gzip"),("Server","ESF"),("X-XSS-Protection","1; mode=block"),("Alt-Svc","quic=\":443\"; ma=2592000; v=\"35,34\""),("Transfer-Encoding","chunked"),("X-Response-Body-Start","<title>Error 404 (Not Found)!!1</title><style>*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px;}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}pre{white-space:pre-wrap;}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}</style>

404. That\226\128\153s an error.

The requested URL was not found on this server. That\226\128\153s all we know.

"),("X-Request-URL","GET https://www.google.com:443/accounts/o8/id")] (CJ {expose = []})

Log in with yahoo works.

Add absolutely trivial template

I want a template that just creates a stack.yaml file (mostly so that I don't have to manually select the resolver). IIUC, this is just a blank .hsfiles with a particular name, e.g. yaml-only.hsfiles.

Are you taking pull requests on Yesod templates?

I'd like to submit a yesod template that includes:

  • yesod-auth-account (user/password setup with email verification and password reset)
  • mime-mail-ses

My current setup is for mongoDB, but I could also cover postgres.

In general, however, I wish there was a QQ solution in Yesod for this kind of setup. Plug-n-play...

Licence

Hello. Would it be possible to confirm the licence for these templates, please, for those parts which are not explicitly annotated already? For instance, yesod-postgres.hsfiles bundles Bootstrap as static/css/bootstrap.css which is licensed under MIT, but for the main parts of the templates themselves, I can't find a licence annotation, nor is there anything about it in README.md, nor is there a LICENSE* file. Thanks! Peace, tiredpixel

`stack test` fails to compile for yesod-postgres template

stack test fails to compile when using the yesod-postgres template.

Here is what I am doing to create a new project with stack new and how the error occurs:

$ stack new myproject yesod-postgres
Downloading template "yesod-postgres" to create project "myproject" in myproject/ ...
Using cabal packages:
- myproject/myproject.cabal

Selecting the best among 7 snapshots...

Downloaded lts-5.15 build plan.    
Caching build plan
Fetched package index.                                                                                    
Populated index cache.    
* Matches lts-5.15

Selected resolver: lts-5.15
Initialising configuration using resolver: lts-5.15
Total number of user packages considered: 1
Writing configuration to file: myproject/stack.yaml
All done.
$ cd myproject/
$ stack test
ansi-terminal-0.6.2.3: using precompiled package
HUnit-1.3.1.1: using precompiled package
ansi-wl-pprint-0.6.7.3: using precompiled package
appar-0.1.4: using precompiled package
...
yesod-1.4.3: configure
yesod-1.4.3: build
yesod-1.4.3: copy/register
classy-prelude-yesod-0.12.7: configure
classy-prelude-yesod-0.12.7: build
classy-prelude-yesod-0.12.7: copy/register
myproject-0.0.0: configure (lib + exe + test)
Configuring myproject-0.0.0...
myproject-0.0.0: build (lib + exe + test)
Preprocessing library myproject-0.0.0...
[ 1 of 10] Compiling Model            ( Model.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Model.o )
[ 2 of 10] Compiling Settings         ( Settings.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Settings.o )
[ 3 of 10] Compiling Settings.StaticFiles ( Settings/StaticFiles.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Settings/StaticFiles.o )
[ 4 of 10] Compiling Import.NoFoundation ( Import/NoFoundation.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Import/NoFoundation.o )
[ 5 of 10] Compiling Foundation       ( Foundation.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Foundation.o )
[ 6 of 10] Compiling Import           ( Import.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Import.o )
[ 7 of 10] Compiling Handler.Common   ( Handler/Common.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Handler/Common.o )
[ 8 of 10] Compiling Handler.Home     ( Handler/Home.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Handler/Home.o )
[ 9 of 10] Compiling Handler.Comment  ( Handler/Comment.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Handler/Comment.o )
[10 of 10] Compiling Application      ( Application.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Application.o )

/home/me/temp/myproject/Application.hs:129:18: Warning:
    In the use of ‘loadAppSettings’
    (imported from Import, but defined in Yesod.Default.Config2):
    Deprecated: "Use loadYamlSettings"

/home/me/temp/myproject/Application.hs:139:17: Warning:
    In the use of ‘loadAppSettingsArgs’
    (imported from Import, but defined in Yesod.Default.Config2):
    Deprecated: "Use loadYamlSettingsArgs"
In-place registering myproject-0.0.0...
Preprocessing executable 'myproject' for myproject-0.0.0...
[1 of 1] Compiling Main             ( app/main.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/myproject/myproject-tmp/Main.o )
Linking .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/myproject/myproject ...
Preprocessing test suite 'test' for myproject-0.0.0...
[1 of 5] Compiling TestImport       ( test/TestImport.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/test/test-tmp/TestImport.o )

/home/me/temp/myproject/test/TestImport.hs:3:7:
    Conflicting exports for ‘delete’:
       ‘module X’ exports ‘X.delete’
         imported from ‘ClassyPrelude’ at test/TestImport.hs:7:1-33
         (and originally defined in ‘mono-traversable-0.10.2:Data.Sequences’)
       ‘module X’ exports ‘X.delete’
         imported from ‘Database.Persist’ at test/TestImport.hs:8:1-46
         (and originally defined in ‘persistent-2.2.4.1:Database.Persist.Class.PersistStore’)

/home/me/temp/myproject/test/TestImport.hs:3:7:
    Conflicting exports for ‘deleteBy’:
       ‘module X’ exports ‘X.deleteBy’
         imported from ‘ClassyPrelude’ at test/TestImport.hs:7:1-33
         (and originally defined in ‘mono-traversable-0.10.2:Data.Sequences’)
       ‘module X’ exports ‘X.deleteBy’
         imported from ‘Database.Persist’ at test/TestImport.hs:8:1-46
         (and originally defined in ‘persistent-2.2.4.1:Database.Persist.Class.PersistUnique’)
Progress: 190/191
--  While building package myproject-0.0.0 using:
      /home/me/.stack/setup-exe-cache/x86_64-linux/setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 build lib:myproject exe:myproject test:test --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1

It looks like both ClassyPrelude and Database.Persist are exporting delete and deleteBy.

It looks like ClassyPrelude.Yesod gets around this by hiding delete and deleteBy from ClassyPrelude.

ping @snoyberg

Yesod templates should have InstanceSigs

Types are the best documentation, and I'm looking up the method signatures on these functions a lot when I'm getting back into Yesod development.

Including InstanceSigs and type signatures on the methods would make this much easier 😄

Hand out commit bits for stack-templates

Hmmm ... quite a few rotting PRs and issues. Can we open this repository up to more contributors having commit access? Stack templates are cool and shouldn't sit here gathering dust. There's been 34 contributors so far, surely we can manage this :)

Pinging @Narrative, @snoyberg and @chrisdone as you are the top 3 commiters.

Use SPDX license descriptors by default

At least the default template uses BSD3 for a license identifier. Cabal now supports SPDX license identifiers (and stack is getting features which also support this, e.g. as arguments to ls dependencies). It may be good for the templates to use the SPDX equivalent (BSD-3-Clause) instead.

hpack support

Wouldn't it be a good idea to convert templates from cabal to hpack? Or perhaps the templates could provide both so users can choose?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.