├── .travis.yml ├── LICENSE ├── STACK_HELP.md ├── scotty-hello-world.hsfiles ├── template-info.yaml ├── foundation.hsfiles ├── simple-hpack.hsfiles ├── simple-library-hpack.hsfiles ├── unicode-syntax-exe.hsfiles ├── simple.hsfiles ├── simple-library.hsfiles ├── unicode-syntax-lib.hsfiles ├── README.md ├── new-template.hsfiles ├── spock.hsfiles ├── test-templates.hs ├── tasty-discover.hsfiles ├── chrisdone.hsfiles ├── rubik.hsfiles ├── kurt.hsfiles ├── servant.hsfiles ├── gtk4.hsfiles ├── quickcheck-test-framework.hsfiles ├── hspec.hsfiles ├── protolude.hsfiles ├── servant-docker.hsfiles ├── haskeleton.hsfiles ├── rio.hsfiles ├── franklinchen.hsfiles ├── scotty-hspec-wai.hsfiles ├── hakyll-template.hsfiles ├── tasty-travis.hsfiles └── readme-lhs.hsfiles /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: c 4 | 5 | addons: 6 | apt: 7 | packages: 8 | - libgmp-dev 9 | 10 | cache: 11 | directories: 12 | - $HOME/.stack 13 | 14 | before_install: 15 | - mkdir -p ~/.local/bin 16 | - export PATH=$HOME/.local/bin:$PATH 17 | - travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' 18 | - stack --version 19 | 20 | script: 21 | - ./test-templates.hs 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-2023 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /STACK_HELP.md: -------------------------------------------------------------------------------- 1 | # Stack Templates 2 | 3 | The `stack new` command will create a new project based on a project template. 4 | Templates can be located on the local filesystem; Github, GitLab or 5 | Bitbucket repositories; or arbitrary URLs. 6 | 7 | Stack allows any GitHub, GitLab or Bitbucket repository named 8 | `stack-templates` to provide project templates for Stack. For example, a 9 | template file at `username/stack-templates/my-template.hsfiles` on GitHub can be 10 | identified as `username/my-template` when using `stack new`. The relevant 11 | service can be specified by prefixing `github:` (the default), `gitlab:` or 12 | `bitbucket:`. 13 | 14 | For more information, please see the user guide: 15 | 16 | https://docs.haskellstack.org/en/stable/templates_command/ 17 | 18 | There are many project templates available at 19 | `commercialhaskell/stack-templates` on GitHub (the default repository) or other 20 | locations. Some simple examples: 21 | 22 | stack new myproj # uses the default template (new-template) 23 | stack new myproj2 rio # uses the rio template at the default repository 24 | stack new website yesodweb/sqlite # Yesod server with SQLite DB 25 | 26 | For more information and other project templates, please see the 27 | `stack-templates` Wiki: 28 | 29 | https://github.com/commercialhaskell/stack-templates/wiki 30 | 31 | Please feel free to add information about your own project templates to that 32 | Wiki for discoverability. 33 | 34 | Want to improve this text? Send us a pull request! 35 | 36 | https://github.com/commercialhaskell/stack-templates/edit/master/STACK_HELP.md 37 | -------------------------------------------------------------------------------- /scotty-hello-world.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | name: {{name}} 3 | version: 0.0.0 4 | cabal-version: >= 1.8 5 | build-type: Simple 6 | 7 | executable {{name}} 8 | hs-source-dirs: . 9 | main-is: Main.hs 10 | extensions: OverloadedStrings 11 | build-depends: base >= 4 && < 5 12 | , scotty >= 0.20.1 13 | ghc-options: -Wall 14 | -Wcompat 15 | -Widentities 16 | -Wincomplete-record-updates 17 | -Wincomplete-uni-patterns 18 | -Wmissing-export-lists 19 | -Wmissing-home-modules 20 | -Wpartial-fields 21 | -Wredundant-constraints 22 | -O2 23 | -threaded 24 | -rtsopts 25 | -with-rtsopts=-N 26 | 27 | {-# START_FILE Main.hs #-} 28 | {-# LANGUAGE OverloadedStrings #-} 29 | 30 | import Web.Scotty 31 | 32 | main :: IO () 33 | main = scotty 3000 $ do 34 | get "/:word" $ do 35 | beam <- captureParam "word" 36 | html $ mconcat ["

Scotty, ", beam, " me up!

"] 37 | 38 | {-# START_FILE .ghci #-} 39 | :set -XOverloadedStrings 40 | 41 | {-# START_FILE .gitignore #-} 42 | # GHC build artefacts 43 | *.hi 44 | *.o 45 | 46 | # Haskell Tool Stack-related 47 | .stack-work/ 48 | 49 | # Cabal-related 50 | .cabal-sandbox 51 | cabal.sandbox.config 52 | 53 | # macOS related 54 | .DS_Store 55 | 56 | # Vim-related 57 | *.swp 58 | 59 | # keter package-related: https://hackage.haskell.org/package/keter 60 | *.keter 61 | -------------------------------------------------------------------------------- /template-info.yaml: -------------------------------------------------------------------------------- 1 | chrisdone: 2 | description: 3 | 4 | foundation: 5 | description: > 6 | Project based on an alternative prelude with batteries and no dependencies. 7 | 8 | franklinchen: 9 | description: 10 | 11 | gkt4: 12 | description: > 13 | Project based on gi-gtk >= 4.0. 14 | 15 | hakyll-template: 16 | description: A static website compiler library. 17 | 18 | haskeleton: 19 | description: A project skeleton for Haskell packages. 20 | 21 | hspec: 22 | description: > 23 | A testing framework for Haskell inspired by the Ruby library RSpec. 24 | 25 | kurt: 26 | description: 27 | 28 | new-template: 29 | description: 30 | 31 | protolude: 32 | description: Project using a custom Prelude based on the Protolude library. 33 | 34 | quickcheck-test-framework: 35 | description: a library for random testing of program properties. 36 | 37 | rio: 38 | description: > 39 | Application template using the RIO monad. Has logging and options parsing. 40 | 41 | readme-lhs: 42 | description: Small scale, quick start, literate haskell projects. 43 | 44 | rubik: 45 | description: 46 | 47 | scotty-hello-world: 48 | description: > 49 | Simple executable making use of the scotty library, which provides a 50 | Haskell web framework inspired by Ruby's Sinatra, using WAI and Warp. 51 | 52 | scotty-hspec-wai: 53 | description: > 54 | Simple executable and test-suite making use of the scotty and wai libraries. 55 | scotty provides a Haskell web framework inspired by Ruby's Sinatra, using 56 | WAI and Warp. wai (Web Application Interface) provides a common protocol for 57 | communication between web applications and web servers. 58 | 59 | servant: 60 | description: A set of packages for declaring web APIs at the type-level. 61 | 62 | servant-docker: 63 | description: 64 | 65 | simple: 66 | description: 67 | 68 | simple-hpack: 69 | description: 70 | 71 | simple-library: 72 | description: 73 | 74 | spock: 75 | description: A lightweight web framework. 76 | 77 | tasty-discover: 78 | description: A project with tasty-discover with setup. 79 | 80 | tasty-travis: 81 | description: 82 | 83 | unicode-syntax-exe: 84 | description: 85 | 86 | unicode-syntax-lib: 87 | description: 88 | -------------------------------------------------------------------------------- /foundation.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | name: {{name}} 3 | version: 0.1.0.0 4 | -- synopsis: 5 | -- description: 6 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 7 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 8 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 9 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 10 | category: {{category}}{{^category}}Web{{/category}} 11 | build-type: Simple 12 | cabal-version: >=1.10 13 | extra-source-files: README.md 14 | CHANGELOG.md 15 | 16 | executable {{name}} 17 | hs-source-dirs: src 18 | main-is: Main.hs 19 | default-language: Haskell2010 20 | default-extensions: NoImplicitPrelude 21 | , OverloadedStrings 22 | build-depends: base >= 4.7 && < 5 23 | , foundation 24 | ghc-options: -Wall 25 | -Wcompat 26 | -Widentities 27 | -Wincomplete-record-updates 28 | -Wincomplete-uni-patterns 29 | -Wmissing-export-lists 30 | -Wmissing-home-modules 31 | -Wpartial-fields 32 | -Wredundant-constraints 33 | 34 | {-# START_FILE Setup.hs #-} 35 | import Distribution.Simple 36 | main = defaultMain 37 | 38 | {-# START_FILE src/Main.hs #-} 39 | module Main (main) where 40 | 41 | import Foundation 42 | 43 | main :: IO () 44 | main = do 45 | putStrLn $ "hello " <> "world" 46 | 47 | {-# START_FILE .ghci #-} 48 | :set -XOverloadedStrings 49 | 50 | {-# START_FILE README.md #-} 51 | # {{name}} 52 | 53 | {-# START_FILE CHANGELOG.md #-} 54 | # Changelog for `{{ name }}` 55 | 56 | All notable changes to this project will be documented in this file. 57 | 58 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 59 | and this project adheres to the 60 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 61 | 62 | ## Unreleased 63 | 64 | ## 0.1.0.0 - YYYY-MM-DD 65 | -------------------------------------------------------------------------------- /simple-hpack.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE package.yaml #-} 2 | name: {{name}} 3 | version: 0.1.0.0 4 | #synopsis: 5 | #description: 6 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 7 | license: BSD-3-Clause 8 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 9 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 10 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 11 | category: {{category}}{{^category}}Web{{/category}} 12 | extra-source-files: 13 | - README.md 14 | - CHANGELOG.md 15 | 16 | dependencies: 17 | - base >= 4.7 && < 5 18 | 19 | ghc-options: 20 | - -Wall 21 | - -Wcompat 22 | - -Widentities 23 | - -Wincomplete-record-updates 24 | - -Wincomplete-uni-patterns 25 | - -Wmissing-export-lists 26 | - -Wmissing-home-modules 27 | - -Wpartial-fields 28 | - -Wredundant-constraints 29 | 30 | executables: 31 | {{name}}: 32 | source-dirs: src 33 | main: Main.hs 34 | 35 | github: {{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 36 | 37 | {-# START_FILE Setup.hs #-} 38 | import Distribution.Simple 39 | main = defaultMain 40 | 41 | {-# START_FILE src/Main.hs #-} 42 | module Main (main) where 43 | 44 | main :: IO () 45 | main = do 46 | putStrLn "hello world" 47 | 48 | {-# START_FILE README.md #-} 49 | # {{name}} 50 | 51 | {-# START_FILE CHANGELOG.md #-} 52 | # Changelog for `{{ name }}` 53 | 54 | All notable changes to this project will be documented in this file. 55 | 56 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 57 | and this project adheres to the 58 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 59 | 60 | ## Unreleased 61 | 62 | ## 0.1.0.0 - YYYY-MM-DD 63 | 64 | {-# START_FILE LICENSE #-} 65 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 66 | 67 | Redistribution and use in source and binary forms, with or without 68 | modification, are permitted provided that the following conditions are met: 69 | 70 | 1. Redistributions of source code must retain the above copyright notice, this 71 | list of conditions and the following disclaimer. 72 | 73 | 2. Redistributions in binary form must reproduce the above copyright notice, 74 | this list of conditions and the following disclaimer in the documentation 75 | and/or other materials provided with the distribution. 76 | 77 | 3. Neither the name of the copyright holder nor the names of its contributors 78 | may be used to endorse or promote products derived from this software 79 | without specific prior written permission. 80 | 81 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 82 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 83 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 84 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 85 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 86 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 87 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 88 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 89 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 90 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 91 | -------------------------------------------------------------------------------- /simple-library-hpack.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE package.yaml #-} 2 | name: {{name}} 3 | version: 0.1.0.0 4 | #synopsis: 5 | #description: 6 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 7 | license: BSD-3-Clause 8 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 9 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 10 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 11 | category: {{category}}{{^category}}Web{{/category}} 12 | extra-source-files: 13 | - README.md 14 | - CHANGELOG.md 15 | 16 | dependencies: 17 | - base >= 4.7 && < 5 18 | 19 | ghc-options: 20 | - -Wall 21 | - -Wcompat 22 | - -Widentities 23 | - -Wincomplete-record-updates 24 | - -Wincomplete-uni-patterns 25 | - -Wmissing-export-lists 26 | - -Wmissing-home-modules 27 | - -Wpartial-fields 28 | - -Wredundant-constraints 29 | 30 | library: 31 | source-dirs: src 32 | exposed-modules: 33 | - Lib 34 | 35 | github: {{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 36 | 37 | {-# START_FILE Setup.hs #-} 38 | import Distribution.Simple 39 | main = defaultMain 40 | 41 | {-# START_FILE src/Lib.hs #-} 42 | module Lib 43 | ( someFunc 44 | ) where 45 | 46 | someFunc :: IO () 47 | someFunc = putStrLn "someFunc" 48 | 49 | {-# START_FILE README.md #-} 50 | # {{name}} 51 | 52 | {-# START_FILE CHANGELOG.md #-} 53 | # Changelog for `{{ name }}` 54 | 55 | All notable changes to this project will be documented in this file. 56 | 57 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 58 | and this project adheres to the 59 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 60 | 61 | ## Unreleased 62 | 63 | ## 0.1.0.0 - YYYY-MM-DD 64 | 65 | {-# START_FILE LICENSE #-} 66 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 67 | 68 | Redistribution and use in source and binary forms, with or without 69 | modification, are permitted provided that the following conditions are met: 70 | 71 | 1. Redistributions of source code must retain the above copyright notice, this 72 | list of conditions and the following disclaimer. 73 | 74 | 2. Redistributions in binary form must reproduce the above copyright notice, 75 | this list of conditions and the following disclaimer in the documentation 76 | and/or other materials provided with the distribution. 77 | 78 | 3. Neither the name of the copyright holder nor the names of its contributors 79 | may be used to endorse or promote products derived from this software 80 | without specific prior written permission. 81 | 82 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 83 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 84 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 85 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 86 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 87 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 88 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 89 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 90 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 91 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 92 | -------------------------------------------------------------------------------- /unicode-syntax-exe.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 9 | license: BSD-3-Clause 10 | license-file: LICENCE 11 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 12 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 13 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 14 | category: {{category}}{{^category}}Web{{/category}} 15 | build-type: Simple 16 | extra-source-files: README.md 17 | CHANGELOG.md 18 | 19 | executable {{name}} 20 | hs-source-dirs: source 21 | default-language: Haskell2010 22 | default-extensions: UnicodeSyntax 23 | , OverloadedStrings 24 | main-is: Main.hs 25 | build-depends: base 26 | , base-unicode-symbols 27 | ghc-options: -Wall 28 | -Wcompat 29 | -Widentities 30 | -Wincomplete-record-updates 31 | -Wincomplete-uni-patterns 32 | -Wmissing-export-lists 33 | -Wmissing-home-modules 34 | -Wpartial-fields 35 | -Wredundant-constraints 36 | 37 | {-# START_FILE Setup.hs #-} 38 | import Distribution.Simple 39 | main = defaultMain 40 | 41 | {-# START_FILE source/Main.hs #-} 42 | main ∷ IO () 43 | main = do 44 | putStrLn "ᚣ" 45 | 46 | {-# START_FILE README.md #-} 47 | # {{name}} 48 | 49 | {-# START_FILE CHANGELOG.md #-} 50 | # Changelog for `{{ name }}` 51 | 52 | All notable changes to this project will be documented in this file. 53 | 54 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 55 | and this project adheres to the 56 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 57 | 58 | ## Unreleased 59 | 60 | ## 0.1.0.0 - YYYY-MM-DD 61 | 62 | {-# START_FILE LICENCE #-} 63 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 64 | 65 | Redistribution and use in source and binary forms, with or without 66 | modification, are permitted provided that the following conditions are met: 67 | 68 | 1. Redistributions of source code must retain the above copyright notice, this 69 | list of conditions and the following disclaimer. 70 | 71 | 2. Redistributions in binary form must reproduce the above copyright notice, 72 | this list of conditions and the following disclaimer in the documentation 73 | and/or other materials provided with the distribution. 74 | 75 | 3. Neither the name of the copyright holder nor the names of its contributors 76 | may be used to endorse or promote products derived from this software 77 | without specific prior written permission. 78 | 79 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 80 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 81 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 82 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 83 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 84 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 85 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 86 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 87 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 88 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 89 | -------------------------------------------------------------------------------- /simple.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 9 | license: BSD-3-Clause 10 | license-file: LICENSE 11 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 12 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 13 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 14 | category: {{category}}{{^category}}Web{{/category}} 15 | build-type: Simple 16 | extra-source-files: README.md 17 | CHANGELOG.md 18 | 19 | executable {{name}} 20 | hs-source-dirs: src 21 | main-is: Main.hs 22 | default-language: Haskell2010 23 | build-depends: base >= 4.7 && < 5 24 | ghc-options: -Wall 25 | -Wcompat 26 | -Widentities 27 | -Wincomplete-record-updates 28 | -Wincomplete-uni-patterns 29 | -Wmissing-export-lists 30 | -Wmissing-home-modules 31 | -Wpartial-fields 32 | -Wredundant-constraints 33 | 34 | source-repository head 35 | type: git 36 | location: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 37 | 38 | {-# START_FILE Setup.hs #-} 39 | import Distribution.Simple 40 | main = defaultMain 41 | 42 | {-# START_FILE README.md #-} 43 | # {{name}} 44 | 45 | {-# START_FILE CHANGELOG.md #-} 46 | # Changelog for `{{ name }}` 47 | 48 | All notable changes to this project will be documented in this file. 49 | 50 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 51 | and this project adheres to the 52 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 53 | 54 | ## Unreleased 55 | 56 | ## 0.1.0.0 - YYYY-MM-DD 57 | 58 | {-# START_FILE src/Main.hs #-} 59 | module Main (main) where 60 | 61 | main :: IO () 62 | main = do 63 | putStrLn "hello world" 64 | 65 | {-# START_FILE LICENSE #-} 66 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 67 | 68 | Redistribution and use in source and binary forms, with or without 69 | modification, are permitted provided that the following conditions are met: 70 | 71 | 1. Redistributions of source code must retain the above copyright notice, this 72 | list of conditions and the following disclaimer. 73 | 74 | 2. Redistributions in binary form must reproduce the above copyright notice, 75 | this list of conditions and the following disclaimer in the documentation 76 | and/or other materials provided with the distribution. 77 | 78 | 3. Neither the name of the copyright holder nor the names of its contributors 79 | may be used to endorse or promote products derived from this software 80 | without specific prior written permission. 81 | 82 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 83 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 84 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 85 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 86 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 87 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 88 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 89 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 90 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 91 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 92 | -------------------------------------------------------------------------------- /simple-library.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 9 | license: BSD-3-Clause 10 | license-file: LICENSE 11 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 12 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 13 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 14 | category: {{category}}{{^category}}Web{{/category}} 15 | build-type: Simple 16 | extra-source-files: README.md 17 | CHANGELOG.md 18 | 19 | library 20 | hs-source-dirs: src 21 | exposed-modules: Lib 22 | build-depends: base >= 4.7 && < 5 23 | default-language: Haskell2010 24 | ghc-options: -Wall 25 | -Wcompat 26 | -Widentities 27 | -Wincomplete-record-updates 28 | -Wincomplete-uni-patterns 29 | -Wmissing-export-lists 30 | -Wmissing-home-modules 31 | -Wpartial-fields 32 | -Wredundant-constraints 33 | 34 | source-repository head 35 | type: git 36 | location: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 37 | 38 | {-# START_FILE Setup.hs #-} 39 | import Distribution.Simple 40 | main = defaultMain 41 | 42 | {-# START_FILE src/Lib.hs #-} 43 | module Lib 44 | ( someFunc 45 | ) where 46 | 47 | someFunc :: IO () 48 | someFunc = putStrLn "someFunc" 49 | 50 | {-# START_FILE README.md #-} 51 | # {{name}} 52 | 53 | {-# START_FILE CHANGELOG.md #-} 54 | # Changelog for `{{ name }}` 55 | 56 | All notable changes to this project will be documented in this file. 57 | 58 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 59 | and this project adheres to the 60 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 61 | 62 | ## Unreleased 63 | 64 | ## 0.1.0.0 - YYYY-MM-DD 65 | 66 | {-# START_FILE LICENSE #-} 67 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 68 | 69 | Redistribution and use in source and binary forms, with or without 70 | modification, are permitted provided that the following conditions are met: 71 | 72 | 1. Redistributions of source code must retain the above copyright notice, this 73 | list of conditions and the following disclaimer. 74 | 75 | 2. Redistributions in binary form must reproduce the above copyright notice, 76 | this list of conditions and the following disclaimer in the documentation 77 | and/or other materials provided with the distribution. 78 | 79 | 3. Neither the name of the copyright holder nor the names of its contributors 80 | may be used to endorse or promote products derived from this software 81 | without specific prior written permission. 82 | 83 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 84 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 85 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 86 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 87 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 88 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 89 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 90 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 91 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 92 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 93 | -------------------------------------------------------------------------------- /unicode-syntax-lib.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 9 | license: BSD-3-Clause 10 | license-file: LICENCE 11 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 12 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 13 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 14 | category: {{category}}{{^category}}Data{{/category}} 15 | build-type: Simple 16 | extra-source-files: README.md 17 | CHANGELOG.md 18 | library 19 | hs-source-dirs: source 20 | default-language: Haskell2010 21 | default-extensions: UnicodeSyntax 22 | , OverloadedStrings 23 | exposed-modules: Library 24 | build-depends: base 25 | , base-unicode-symbols 26 | ghc-options: -Wall 27 | -Wcompat 28 | -Widentities 29 | -Wincomplete-record-updates 30 | -Wincomplete-uni-patterns 31 | -Wmissing-export-lists 32 | -Wmissing-home-modules 33 | -Wpartial-fields 34 | -Wredundant-constraints 35 | 36 | {-# START_FILE source/Library.hs #-} 37 | module Library 38 | ( 𝕋 (..) 39 | , ϝ 40 | ) where 41 | 42 | data 𝕋 α β 43 | = ℍ α 44 | | ℙ β 45 | | ℚ α β 46 | deriving (Eq) 47 | 48 | ϝ ∷ (α → γ) → (β → γ) → (α → β → γ) → 𝕋 α β → γ 49 | ϝ l _ _ (ℍ a ) = l a 50 | ϝ _ r _ (ℙ b ) = r b 51 | ϝ _ _ g (ℚ a b) = g a b 52 | 53 | {-# START_FILE README.md #-} 54 | # {{name}} 55 | 56 | {-# START_FILE CHANGELOG.md #-} 57 | # Changelog for `{{ name }}` 58 | 59 | All notable changes to this project will be documented in this file. 60 | 61 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 62 | and this project adheres to the 63 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 64 | 65 | ## Unreleased 66 | 67 | ## 0.1.0.0 - YYYY-MM-DD 68 | 69 | {-# START_FILE LICENCE #-} 70 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 71 | 72 | Redistribution and use in source and binary forms, with or without 73 | modification, are permitted provided that the following conditions are met: 74 | 75 | 1. Redistributions of source code must retain the above copyright notice, this 76 | list of conditions and the following disclaimer. 77 | 78 | 2. Redistributions in binary form must reproduce the above copyright notice, 79 | this list of conditions and the following disclaimer in the documentation 80 | and/or other materials provided with the distribution. 81 | 82 | 3. Neither the name of the copyright holder nor the names of its contributors 83 | may be used to endorse or promote products derived from this software 84 | without specific prior written permission. 85 | 86 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 87 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 88 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 89 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 90 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 91 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 92 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 93 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 94 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 95 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 96 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Project templates for Stack 2 | 3 | From Stack 1.9.1, Stack allows any GitHub, GitLab or Bitbucket repository named 4 | `stack-templates` to provide project templates for Stack. For example, a 5 | template file at `username/stack-templates/my-template.hsfiles` on GitHub can be 6 | identified as `username/my-template` when using `stack new`. For more 7 | information see the output of the `stack templates` command and its 8 | [documentation](https://docs.haskellstack.org/en/stable/commands/templates_command/). 9 | 10 | This repository provides the project template `new-template`, which is the 11 | default template used by `stack new`. It also provides `STACK_HELP.md`, which 12 | specifies the output of the `stack templates` command. 13 | 14 | This repository is the default one used by Stack and it provides 24 other 15 | project templates. Information about some of those templates is included in 16 | `template-info.yaml` and this repository's Wiki. 17 | 18 | Those project templates are maintained but this repository is not accepting new 19 | templates because of the difficulties in maintaining large numbers of templates 20 | centrally. 21 | 22 | This repository's Wiki provides a place where the Haskell community can 23 | announce the availability of project templates at other locations. 24 | 25 | ## License 26 | 27 | All the templates in this repository use identifiers from the 28 | [SPDX License List](https://spdx.org/licenses/) and all but two specify 29 | `BSD-3-Clause`. 30 | 31 | The SPDX expression syntax was first required by the Cabal 32 | Package Description Format Specification version 2.2 and that version is 33 | specified in template Cabal files. Hpack will also detect that the use of 34 | `BSD-3-Clause` in a template `package.yaml` file requires `cabal-version: 2.2` 35 | in a Cabal file. 36 | 37 | Stack, however, also supports versions of GHC that come with versions of the 38 | `Cabal` library before `Cabal-2.2.0.0`. If you are using such versions of GHC, 39 | edit the files produced by the template to replace `BSD-3-Clause` with `BSD3` 40 | and edit any Cabal files produced by the template to replace 41 | `cabal-version: 2.2` with `cabal-version: >=1.10`. 42 | 43 | ## Project template format 44 | 45 | Each project template is specified in an `.hsfiles` file, using the syntax of 46 | the [Mustache](https://mustache.github.io/mustache.1.html) tool. 47 | 48 | Each file to be generated by the project template is specified with 49 | `START_FILE`, like this: 50 | 51 | ``` 52 | {-# START_FILE {{name}}.cabal #-} 53 | name: {{name}} 54 | version: 0.1.0.0 55 | ... 56 | ``` 57 | 58 | Parameters to the template are written `{{foo}}`. They are provided by users via 59 | their Stack `config.yaml` file, like this: 60 | 61 | ``` yaml 62 | templates: 63 | params: 64 | author-email: chrisdone@gmail.com 65 | author-name: Chris Done 66 | copyright: 2023 Chris Done 67 | github-username: chrisdone 68 | category: Development 69 | ``` 70 | 71 | When the user runs `stack new my-project username/your-template` and they do not 72 | have the parameters provided in their Stack `config.yaml`, Stack will warn the 73 | user that such parameters were missing, like this: 74 | 75 | ``` 76 | Downloading template username/your-template to create project my-project in 77 | directory my-project/ ... 78 | Downloaded . 79 | 80 | Note: The following parameters were needed by the template but not provided: 81 | author-email, and author-name. 82 | 83 | You can provide them in Stack's global YAML configuration file 84 | () like this: 85 | 86 | templates: 87 | params: 88 | author-email: value 89 | author-name: value 90 | 91 | Or you can pass each one on the command line as parameters like this: 92 | 93 | stack new my-project username/your-template -p "author-email:value" 94 | -p "author-name:value" 95 | ``` 96 | 97 | The output of the template will yield a blank space where your parameter was. If 98 | you want to provide default values for your template parameters, use this 99 | Mustache syntax: 100 | 101 | ``` 102 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 103 | ``` 104 | 105 | ## Related initiatives 106 | 107 | The repository https://github.com/prikhi/stack-templatizer (unconnected with 108 | this repository) provides Haskell source code to build an application that 109 | will generate an `.hsfiles` file from the contents of a folder. 110 | 111 | ## Yesod templates 112 | 113 | The Yesod templates are generated from the 114 | [yesod-scaffold repo](https://github.com/yesodweb/yesod-scaffold). Please 115 | send pull requests for those templates to that repository instead of this one. 116 | -------------------------------------------------------------------------------- /new-template.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE package.yaml #-} 2 | name: {{name}} 3 | version: 0.1.0.0 4 | github: "{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}" 5 | license: BSD-3-Clause 6 | author: "{{author-name}}{{^author-name}}Author name here{{/author-name}}" 7 | maintainer: "{{author-email}}{{^author-email}}example@example.com{{/author-email}}" 8 | copyright: "{{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}}" 9 | 10 | extra-source-files: 11 | - README.md 12 | - CHANGELOG.md 13 | 14 | # Metadata used when publishing your package 15 | # synopsis: Short description of your package 16 | # category: {{category}}{{^category}}Web{{/category}} 17 | 18 | # To avoid duplicated efforts in documentation and dealing with the 19 | # complications of embedding Haddock markup inside cabal files, it is 20 | # common to point users to the README.md file. 21 | description: Please see the README on GitHub at 22 | 23 | dependencies: 24 | - base >= 4.7 && < 5 25 | 26 | ghc-options: 27 | - -Wall 28 | - -Wcompat 29 | - -Widentities 30 | - -Wincomplete-record-updates 31 | - -Wincomplete-uni-patterns 32 | - -Wmissing-export-lists 33 | - -Wmissing-home-modules 34 | - -Wpartial-fields 35 | - -Wredundant-constraints 36 | 37 | library: 38 | source-dirs: src 39 | 40 | executables: 41 | {{name}}-exe: 42 | main: Main.hs 43 | source-dirs: app 44 | ghc-options: 45 | - -threaded 46 | - -rtsopts 47 | - -with-rtsopts=-N 48 | dependencies: 49 | - {{name}} 50 | 51 | tests: 52 | {{name}}-test: 53 | main: Spec.hs 54 | source-dirs: test 55 | ghc-options: 56 | - -threaded 57 | - -rtsopts 58 | - -with-rtsopts=-N 59 | dependencies: 60 | - {{name}} 61 | 62 | {-# START_FILE Setup.hs #-} 63 | import Distribution.Simple 64 | main = defaultMain 65 | 66 | {-# START_FILE test/Spec.hs #-} 67 | main :: IO () 68 | main = putStrLn "Test suite not yet implemented" 69 | 70 | {-# START_FILE src/Lib.hs #-} 71 | module Lib 72 | ( someFunc 73 | ) where 74 | 75 | someFunc :: IO () 76 | someFunc = putStrLn "someFunc" 77 | 78 | {-# START_FILE app/Main.hs #-} 79 | module Main (main) where 80 | 81 | import Lib 82 | 83 | main :: IO () 84 | main = someFunc 85 | 86 | {-# START_FILE README.md #-} 87 | # {{name}} 88 | 89 | {-# START_FILE CHANGELOG.md #-} 90 | # Changelog for `{{ name }}` 91 | 92 | All notable changes to this project will be documented in this file. 93 | 94 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 95 | and this project adheres to the 96 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 97 | 98 | ## Unreleased 99 | 100 | ## 0.1.0.0 - YYYY-MM-DD 101 | 102 | {-# START_FILE LICENSE #-} 103 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 104 | 105 | Redistribution and use in source and binary forms, with or without 106 | modification, are permitted provided that the following conditions are met: 107 | 108 | 1. Redistributions of source code must retain the above copyright notice, this 109 | list of conditions and the following disclaimer. 110 | 111 | 2. Redistributions in binary form must reproduce the above copyright notice, 112 | this list of conditions and the following disclaimer in the documentation 113 | and/or other materials provided with the distribution. 114 | 115 | 3. Neither the name of the copyright holder nor the names of its contributors 116 | may be used to endorse or promote products derived from this software 117 | without specific prior written permission. 118 | 119 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 120 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 121 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 122 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 123 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 124 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 125 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 126 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 127 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 128 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 129 | 130 | {-# START_FILE .gitignore #-} 131 | .stack-work/ 132 | *~ 133 | -------------------------------------------------------------------------------- /spock.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 9 | license: BSD-3-Clause 10 | license-file: LICENSE 11 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 12 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 13 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 14 | category: {{category}}{{^category}}Web{{/category}} 15 | build-type: Simple 16 | extra-source-files: README.md 17 | CHANGELOG.md 18 | 19 | executable {{name}} 20 | hs-source-dirs: app 21 | main-is: Main.hs 22 | default-language: Haskell2010 23 | build-depends: base >= 4.7 && < 5 24 | , Spock >= 0.11 25 | , mtl 26 | , text 27 | ghc-options: -Wall 28 | -Wcompat 29 | -Widentities 30 | -Wincomplete-record-updates 31 | -Wincomplete-uni-patterns 32 | -Wmissing-export-lists 33 | -Wmissing-home-modules 34 | -Wpartial-fields 35 | -Wredundant-constraints 36 | 37 | {-# START_FILE Setup.hs #-} 38 | import Distribution.Simple 39 | main = defaultMain 40 | 41 | {-# START_FILE app/Main.hs #-} 42 | {-# LANGUAGE OverloadedStrings #-} 43 | module Main (main) where 44 | 45 | import Web.Spock 46 | import Web.Spock.Config 47 | 48 | import Control.Monad.Trans 49 | import Data.Monoid 50 | import Data.IORef 51 | import qualified Data.Text as T 52 | 53 | data MySession = EmptySession 54 | data MyAppState = DummyAppState (IORef Int) 55 | 56 | main :: IO () 57 | main = 58 | do ref <- newIORef 0 59 | spockCfg <- defaultSpockCfg EmptySession PCNoDatabase (DummyAppState ref) 60 | runSpock 8080 (spock spockCfg app) 61 | 62 | app :: SpockM () MySession MyAppState () 63 | app = 64 | do get root $ 65 | text "Hello World!" 66 | get ("hello" var) $ \name -> 67 | do (DummyAppState ref) <- getState 68 | visitorNumber <- liftIO $ atomicModifyIORef' ref $ \i -> (i+1, i+1) 69 | text ("Hello " <> name <> ", you are visitor number " <> T.pack (show visitorNumber)) 70 | 71 | {-# START_FILE README.md #-} 72 | # {{name}} 73 | 74 | {-# START_FILE CHANGELOG.md #-} 75 | # Changelog for `{{ name }}` 76 | 77 | All notable changes to this project will be documented in this file. 78 | 79 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 80 | and this project adheres to the 81 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 82 | 83 | ## Unreleased 84 | 85 | ## 0.1.0.0 - YYYY-MM-DD 86 | 87 | {-# START_FILE LICENSE #-} 88 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 89 | 90 | Redistribution and use in source and binary forms, with or without 91 | modification, are permitted provided that the following conditions are met: 92 | 93 | 1. Redistributions of source code must retain the above copyright notice, this 94 | list of conditions and the following disclaimer. 95 | 96 | 2. Redistributions in binary form must reproduce the above copyright notice, 97 | this list of conditions and the following disclaimer in the documentation 98 | and/or other materials provided with the distribution. 99 | 100 | 3. Neither the name of the copyright holder nor the names of its contributors 101 | may be used to endorse or promote products derived from this software 102 | without specific prior written permission. 103 | 104 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 105 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 106 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 107 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 108 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 109 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 110 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 111 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 112 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 113 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 114 | -------------------------------------------------------------------------------- /test-templates.hs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env stack 2 | {- 3 | stack script 4 | --resolver lts-19.16 5 | --no-terminal 6 | --package mockery 7 | --package getopt-generics 8 | --package text 9 | --package unordered-containers 10 | --package yaml 11 | --package directory 12 | --package filepath 13 | --package process 14 | --package aeson 15 | -} 16 | 17 | {-# LANGUAGE ScopedTypeVariables #-} 18 | 19 | module Main (main) where 20 | 21 | import Control.Arrow ((***)) 22 | import Control.Monad (forM_, unless) 23 | import Data.Aeson.Key (toString) 24 | import Data.Aeson.KeyMap (keys) 25 | import Data.List 26 | import Data.Maybe (fromMaybe) 27 | import Data.Monoid 28 | import qualified Data.Text as T 29 | import Data.Yaml (ParseException, Object) 30 | import qualified Data.Yaml as Yaml 31 | import System.Directory 32 | import System.Exit (die) 33 | import System.FilePath ((), dropExtension, takeExtension, takeBaseName) 34 | import System.IO 35 | import System.Process 36 | import Test.Mockery.Directory 37 | import WithCli 38 | 39 | excluded :: [String] 40 | excluded = 41 | "ghcjs-old-base" : -- ghcjs takes too long to setup 42 | "ghcjs" : -- ghcjs takes too long to setup 43 | "hakyll-template" : -- hakyll takes an excessive amount of time to compile its dependencies 44 | "quickcheck-test-framework" : -- test-suite fails (probably intentionally) 45 | "spock" : -- Spock not in LTS since lts-12.26 (GHC 8.4.4) 46 | "tasty-discover" : -- contains a stack file, makes `stack new` choke 47 | "tasty-travis" : -- the two `prop>` in `*-doctest` test suite fail. See 48 | -- https://github.com/sol/doctest/issues/202#issuecomment-1194695852 49 | "yesod-mongo" : -- needs a running db instance 50 | "yesod-mysql" : -- needs a running db instance 51 | "yesod-postgres-fay" : -- needs a running db instance 52 | "yesod-postgres" : -- needs a running db instance 53 | "yesod-sqlite" : -- missing CSFR cookie? 54 | [] 55 | 56 | isExcluded :: FilePath -> Bool 57 | isExcluded file = dropExtension file `elem` excluded 58 | 59 | main :: IO () 60 | main = do 61 | logImportant $ "Verifying " <> templateInfoFile 62 | verified <- verifyInfo 63 | case verified of 64 | Left err -> die err 65 | _ -> return () 66 | 67 | withHsfiles $ \ hsfiles -> 68 | forM_ hsfiles $ \ hsfile -> do 69 | logImportant ("testing " ++ takeBaseName hsfile) 70 | inTempDirectory $ do 71 | callCommand ("stack new test-project " ++ hsfile ++ " --no-terminal") 72 | setCurrentDirectory "test-project" 73 | callCommand "stack test --fast --no-terminal --install-ghc" 74 | 75 | withHsfiles :: ([FilePath] -> IO ()) -> IO () 76 | withHsfiles action = withCli $ \ (args :: [FilePath]) -> do 77 | hsfiles <- case args of 78 | [] -> fmap (filter $ not . isExcluded) getHsfiles 79 | _ -> do 80 | mapM_ checkExists args 81 | return args 82 | currentDirectory <- canonicalizePath =<< getCurrentDirectory 83 | action $ map (currentDirectory ) hsfiles 84 | 85 | verifyInfo :: IO (Either String ()) 86 | verifyInfo = do 87 | checkExists templateInfoFile 88 | decoded <- Yaml.decodeFileEither templateInfoFile :: IO (Either ParseException Object) 89 | case decoded of 90 | Left ex -> return . Left $ "Invalid " <> templateInfoFile <> " file. " <> show ex 91 | Right o -> do 92 | templates <- getHsfiles 93 | let info = map toString (keys o) 94 | check = uniqueElems (map takeBaseName templates) info 95 | output = notEnough *** tooMuch $ check 96 | case check of 97 | (Nothing, Nothing) -> return $ Right () 98 | _ -> return $ Left $ uncurry (<>) output 99 | where 100 | formatOutput header items = 101 | fromMaybe "" $ unlines . (header :) . map (" - " <>) <$> items 102 | notEnough = formatOutput $ "Add the following templates to " <> templateInfoFile <> ":" 103 | tooMuch = formatOutput $ "Remove the following templates from " <> templateInfoFile <> ":" 104 | 105 | uniqueElems :: Eq a => [a] -> [a] -> (Maybe [a], Maybe [a]) 106 | uniqueElems = bothWays unique 107 | where 108 | bothWays f xs ys = (f xs ys, f ys xs) 109 | unique xs ys = 110 | case xs \\ ys of 111 | [] -> Nothing 112 | diff -> Just diff 113 | 114 | templateInfoFile :: String 115 | templateInfoFile = "template-info.yaml" 116 | 117 | getHsfiles :: IO [FilePath] 118 | getHsfiles = 119 | sort . filter ((== ".hsfiles") . takeExtension) <$> 120 | getDirectoryContents "." 121 | 122 | checkExists :: FilePath -> IO () 123 | checkExists file = do 124 | exists <- doesFileExist file 125 | unless exists $ 126 | die ("file not found: " ++ file) 127 | 128 | logImportant :: String -> IO () 129 | logImportant message = 130 | hPutStrLn stderr $ unlines [line, message, line] 131 | where 132 | line = replicate (length message) '=' 133 | -------------------------------------------------------------------------------- /tasty-discover.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 9 | license: BSD-3-Clause 10 | license-file: LICENSE 11 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 12 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 13 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 14 | category: {{category}}{{^category}}Web{{/category}} 15 | build-type: Simple 16 | extra-source-files: README.md 17 | CHANGELOG.md 18 | 19 | executable {{name}} 20 | hs-source-dirs: src 21 | main-is: Main.hs 22 | default-language: Haskell2010 23 | build-depends: base >= 4.7 && < 5 24 | ghc-options: -Wall 25 | -Wcompat 26 | -Widentities 27 | -Wincomplete-record-updates 28 | -Wincomplete-uni-patterns 29 | -Wmissing-export-lists 30 | -Wmissing-home-modules 31 | -Wpartial-fields 32 | -Wredundant-constraints 33 | 34 | test-suite {{name}}-test 35 | type: exitcode-stdio-1.0 36 | hs-source-dirs: test 37 | main-is: Tasty.hs 38 | other-modules: FooTest 39 | build-depends: base 40 | , tasty-discover 41 | default-language: Haskell2010 42 | ghc-options: -Wall 43 | -Wcompat 44 | -Widentities 45 | -Wincomplete-record-updates 46 | -Wincomplete-uni-patterns 47 | -Wmissing-export-lists 48 | -Wmissing-home-modules 49 | -Wpartial-fields 50 | -Wredundant-constraints 51 | 52 | {-# START_FILE Setup.hs #-} 53 | import Distribution.Simple 54 | main = defaultMain 55 | 56 | {-# START_FILE src/Main.hs #-} 57 | module Main (main) where 58 | 59 | main :: IO () 60 | main = putStrLn "Hello, World!" 61 | 62 | {-# START_FILE test/Tasty.hs #-} 63 | {-# OPTIONS_GHC -F -pgmF tasty-discover #-} 64 | 65 | {-# START_FILE test/FooTest.hs #-} 66 | module FooTest where 67 | 68 | import Test.Tasty.Discover 69 | 70 | prop_something = 2 == 2 71 | 72 | {-# START_FILE stack.yaml #-} 73 | resolver: lts-5.3 74 | packages: 75 | - '.' 76 | - location: 77 | git: "https://github.com/lwm/tasty-discover.git" 78 | commit: "HEAD" 79 | extra-dep: true 80 | extra-deps: 81 | - "tasty-th-0.1.4" 82 | flags: {} 83 | extra-package-dbs: [] 84 | 85 | {-# START_FILE README.md #-} 86 | # {{name}} 87 | 88 | {-# START_FILE CHANGELOG.md #-} 89 | # Changelog for `{{ name }}` 90 | 91 | All notable changes to this project will be documented in this file. 92 | 93 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 94 | and this project adheres to the 95 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 96 | 97 | ## Unreleased 98 | 99 | ## 0.1.0.0 - YYYY-MM-DD 100 | 101 | {-# START_FILE LICENSE #-} 102 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 103 | 104 | Redistribution and use in source and binary forms, with or without 105 | modification, are permitted provided that the following conditions are met: 106 | 107 | 1. Redistributions of source code must retain the above copyright notice, this 108 | list of conditions and the following disclaimer. 109 | 110 | 2. Redistributions in binary form must reproduce the above copyright notice, 111 | this list of conditions and the following disclaimer in the documentation 112 | and/or other materials provided with the distribution. 113 | 114 | 3. Neither the name of the copyright holder nor the names of its contributors 115 | may be used to endorse or promote products derived from this software 116 | without specific prior written permission. 117 | 118 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 119 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 120 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 121 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 122 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 123 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 124 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 125 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 126 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 127 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 128 | -------------------------------------------------------------------------------- /chrisdone.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 9 | license: BSD-3-Clause 10 | license-file: LICENSE 11 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 12 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 13 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 14 | category: {{category}}{{^category}}Web{{/category}} 15 | build-type: Simple 16 | extra-source-files: README.md 17 | CHANGELOG.md 18 | 19 | library 20 | hs-source-dirs: src 21 | exposed-modules: Lib 22 | build-depends: base >= 4.7 && < 5 23 | default-language: Haskell2010 24 | ghc-options: -Wall 25 | -Wcompat 26 | -Widentities 27 | -Wincomplete-record-updates 28 | -Wincomplete-uni-patterns 29 | -Wmissing-export-lists 30 | -Wmissing-home-modules 31 | -Wpartial-fields 32 | -Wredundant-constraints 33 | 34 | executable {{name}}-exe 35 | hs-source-dirs: app 36 | main-is: Main.hs 37 | build-depends: base 38 | , {{name}} 39 | default-language: Haskell2010 40 | ghc-options: -Wall 41 | -Wcompat 42 | -Widentities 43 | -Wincomplete-record-updates 44 | -Wincomplete-uni-patterns 45 | -Wmissing-export-lists 46 | -Wmissing-home-modules 47 | -Wpartial-fields 48 | -Wredundant-constraints 49 | -threaded 50 | -rtsopts 51 | -with-rtsopts=-N 52 | 53 | test-suite {{name}}-test 54 | type: exitcode-stdio-1.0 55 | hs-source-dirs: test 56 | main-is: Spec.hs 57 | build-depends: base 58 | , {{name}} 59 | default-language: Haskell2010 60 | ghc-options: -Wall 61 | -Wcompat 62 | -Widentities 63 | -Wincomplete-record-updates 64 | -Wincomplete-uni-patterns 65 | -Wmissing-export-lists 66 | -Wmissing-home-modules 67 | -Wpartial-fields 68 | -Wredundant-constraints 69 | -threaded 70 | -rtsopts 71 | -with-rtsopts=-N 72 | 73 | source-repository head 74 | type: git 75 | location: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 76 | 77 | {-# START_FILE Setup.hs #-} 78 | import Distribution.Simple 79 | main = defaultMain 80 | 81 | {-# START_FILE test/Spec.hs #-} 82 | main :: IO () 83 | main = putStrLn "Test suite not yet implemented" 84 | 85 | {-# START_FILE src/Lib.hs #-} 86 | module Lib 87 | ( someFunc 88 | ) where 89 | 90 | someFunc :: IO () 91 | someFunc = putStrLn "someFunc" 92 | 93 | {-# START_FILE app/Main.hs #-} 94 | module Main (main) where 95 | 96 | import Lib 97 | 98 | main :: IO () 99 | main = someFunc 100 | 101 | {-# START_FILE README.md #-} 102 | # {{name}} 103 | 104 | add description of {{name}} here 105 | 106 | {-# START_FILE CHANGELOG.md #-} 107 | # Changelog for `{{ name }}` 108 | 109 | All notable changes to this project will be documented in this file. 110 | 111 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 112 | and this project adheres to the 113 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 114 | 115 | ## Unreleased 116 | 117 | ## 0.1.0.0 - YYYY-MM-DD 118 | 119 | {-# START_FILE LICENSE #-} 120 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 121 | 122 | Redistribution and use in source and binary forms, with or without 123 | modification, are permitted provided that the following conditions are met: 124 | 125 | 1. Redistributions of source code must retain the above copyright notice, this 126 | list of conditions and the following disclaimer. 127 | 128 | 2. Redistributions in binary form must reproduce the above copyright notice, 129 | this list of conditions and the following disclaimer in the documentation 130 | and/or other materials provided with the distribution. 131 | 132 | 3. Neither the name of the copyright holder nor the names of its contributors 133 | may be used to endorse or promote products derived from this software 134 | without specific prior written permission. 135 | 136 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 137 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 138 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 139 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 140 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 141 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 142 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 143 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 144 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 145 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 146 | -------------------------------------------------------------------------------- /rubik.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | name: {{name}} 3 | version: 0.1.0.0 4 | -- synopsis: 5 | -- description: 6 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 7 | license: ISC 8 | license-file: LICENSE 9 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 10 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 11 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 12 | category: {{category}}{{^category}}Development{{/category}} 13 | build-type: Simple 14 | extra-source-files: README.md 15 | CHANGELOG.md 16 | cabal-version: >=1.10 17 | 18 | library 19 | hs-source-dirs: src 20 | exposed-modules: Lib 21 | build-depends: base >=4.7 && < 5 22 | default-language: Haskell2010 23 | ghc-options: -Wall 24 | -Wcompat 25 | -Widentities 26 | -Wincomplete-record-updates 27 | -Wincomplete-uni-patterns 28 | -Wmissing-export-lists 29 | -Wmissing-home-modules 30 | -Wpartial-fields 31 | -Wredundant-constraints 32 | 33 | executable {{name}}-exe 34 | hs-source-dirs: app 35 | main-is: Main.hs 36 | build-depends: base >=4.7 && <5 37 | , {{name}} 38 | default-language: Haskell2010 39 | ghc-options: -Wall 40 | -Wcompat 41 | -Widentities 42 | -Wincomplete-record-updates 43 | -Wincomplete-uni-patterns 44 | -Wmissing-export-lists 45 | -Wmissing-home-modules 46 | -Wpartial-fields 47 | -Wredundant-constraints 48 | -threaded 49 | -rtsopts 50 | -with-rtsopts=-N 51 | 52 | test-suite {{name}}-test 53 | type: exitcode-stdio-1.0 54 | hs-source-dirs: test 55 | main-is: Spec.hs 56 | build-depends: base >=4.7 && <5 57 | , {{name}} -any 58 | , hspec ==2.* 59 | default-language: Haskell2010 60 | ghc-options: -Wall 61 | -Wcompat 62 | -Widentities 63 | -Wincomplete-record-updates 64 | -Wincomplete-uni-patterns 65 | -Wmissing-export-lists 66 | -Wmissing-home-modules 67 | -Wpartial-fields 68 | -Wredundant-constraints 69 | -threaded 70 | -rtsopts 71 | -with-rtsopts=-N 72 | 73 | test-suite style 74 | type: exitcode-stdio-1.0 75 | hs-source-dirs: test 76 | main-is: HLint.hs 77 | build-depends: base >=4.7 && <5 78 | , hlint ==3.* 79 | default-language: Haskell2010 80 | ghc-options: -Wall 81 | -Wcompat 82 | -Widentities 83 | -Wincomplete-record-updates 84 | -Wincomplete-uni-patterns 85 | -Wmissing-export-lists 86 | -Wmissing-home-modules 87 | -Wpartial-fields 88 | -Wredundant-constraints 89 | 90 | source-repository head 91 | type: git 92 | location: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 93 | 94 | {-# START_FILE Setup.hs #-} 95 | import Distribution.Simple 96 | main = defaultMain 97 | 98 | {-# START_FILE test/Spec.hs #-} 99 | main :: IO () 100 | main = putStrLn "Test suite not yet implemented" 101 | 102 | {-# START_FILE test/HLint.hs #-} 103 | module Main (main) where 104 | 105 | import Language.Haskell.HLint (hlint) 106 | import System.Exit (exitFailure, exitSuccess) 107 | 108 | arguments :: [String] 109 | arguments = 110 | [ "app" 111 | , "src" 112 | , "test" 113 | ] 114 | 115 | main :: IO () 116 | main = do 117 | hints <- hlint arguments 118 | if null hints then exitSuccess else exitFailure 119 | 120 | {-# START_FILE src/Lib.hs #-} 121 | module Lib 122 | ( someFunc 123 | ) where 124 | 125 | someFunc :: IO () 126 | someFunc = putStrLn "someFunc" 127 | 128 | {-# START_FILE app/Main.hs #-} 129 | module Main (main) where 130 | 131 | import Lib 132 | 133 | main :: IO () 134 | main = someFunc 135 | 136 | {-# START_FILE README.md #-} 137 | # {{name}} 138 | 139 | {-# START_FILE CHANGELOG.md #-} 140 | # Changelog 141 | 142 | This package uses [Semantic Versioning][1]. 143 | 144 | ## v0.1.0.0 145 | 146 | - Initially created. 147 | 148 | [1]: http://semver.org/spec/v2.0.0.html 149 | 150 | {-# START_FILE LICENSE #-} 151 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 152 | 153 | Permission to use, copy, modify, and/or distribute this software for any purpose 154 | with or without fee is hereby granted, provided that the above copyright notice 155 | and this permission notice appear in all copies. 156 | 157 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 158 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 159 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 160 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 161 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 162 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 163 | THIS SOFTWARE. 164 | -------------------------------------------------------------------------------- /kurt.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | synopsis: Short description of your package 7 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 8 | license: BSD-3-Clause 9 | license-file: LICENSE 10 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 11 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 12 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 13 | category: {{category}}{{^category}}Web{{/category}} 14 | build-type: Simple 15 | extra-source-files: README.md 16 | CHANGELOG.md 17 | 18 | -- To avoid duplicated efforts in documentation and dealing with the 19 | -- complications of embedding Haddock markup inside cabal files, it is 20 | -- common to point users to the README.md file. 21 | description: Please see the README on Github at 22 | 23 | library 24 | hs-source-dirs: src 25 | exposed-modules: Lib 26 | build-depends: base >= 4.7 && < 5 27 | default-language: Haskell2010 28 | ghc-options: -Wall 29 | -Wcompat 30 | -Widentities 31 | -Wincomplete-record-updates 32 | -Wincomplete-uni-patterns 33 | -Wmissing-export-lists 34 | -Wmissing-home-modules 35 | -Wpartial-fields 36 | -Wredundant-constraints 37 | 38 | executable {{name}}-exe 39 | hs-source-dirs: app 40 | main-is: Main.hs 41 | build-depends: base 42 | , {{name}} 43 | default-language: Haskell2010 44 | ghc-options: -Wall 45 | -Wcompat 46 | -Widentities 47 | -Wincomplete-record-updates 48 | -Wincomplete-uni-patterns 49 | -Wmissing-export-lists 50 | -Wmissing-home-modules 51 | -Wpartial-fields 52 | -Wredundant-constraints 53 | -threaded 54 | -rtsopts 55 | -with-rtsopts=-N 56 | 57 | test-suite {{name}}-test 58 | type: exitcode-stdio-1.0 59 | hs-source-dirs: test 60 | main-is: Spec.hs 61 | build-depends: base 62 | , {{name}} 63 | default-language: Haskell2010 64 | ghc-options: -Wall 65 | -Wcompat 66 | -Widentities 67 | -Wincomplete-record-updates 68 | -Wincomplete-uni-patterns 69 | -Wmissing-export-lists 70 | -Wmissing-home-modules 71 | -Wpartial-fields 72 | -Wredundant-constraints 73 | -threaded 74 | -rtsopts 75 | -with-rtsopts=-N 76 | 77 | source-repository head 78 | type: git 79 | location: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 80 | 81 | {-# START_FILE Setup.hs #-} 82 | import Distribution.Simple 83 | main = defaultMain 84 | 85 | {-# START_FILE test/Spec.hs #-} 86 | main :: IO () 87 | main = putStrLn "Test suite not yet implemented" 88 | 89 | {-# START_FILE src/Lib.hs #-} 90 | module Lib 91 | ( someFunc 92 | ) where 93 | 94 | someFunc :: IO () 95 | someFunc = putStrLn "someFunc" 96 | 97 | {-# START_FILE app/Main.hs #-} 98 | module Main (main) where 99 | 100 | import Lib 101 | 102 | main :: IO () 103 | main = someFunc 104 | 105 | {-# START_FILE README.md #-} 106 | # {{name}} 107 | 108 | {-# START_FILE CHANGELOG.md #-} 109 | # Changelog for `{{ name }}` 110 | 111 | All notable changes to this project will be documented in this file. 112 | 113 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 114 | and this project adheres to the 115 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 116 | 117 | ## Unreleased 118 | 119 | ## 0.1.0.0 - YYYY-MM-DD 120 | 121 | {-# START_FILE LICENSE #-} 122 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 123 | 124 | Redistribution and use in source and binary forms, with or without 125 | modification, are permitted provided that the following conditions are met: 126 | 127 | 1. Redistributions of source code must retain the above copyright notice, this 128 | list of conditions and the following disclaimer. 129 | 130 | 2. Redistributions in binary form must reproduce the above copyright notice, 131 | this list of conditions and the following disclaimer in the documentation 132 | and/or other materials provided with the distribution. 133 | 134 | 3. Neither the name of the copyright holder nor the names of its contributors 135 | may be used to endorse or promote products derived from this software 136 | without specific prior written permission. 137 | 138 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 139 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 140 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 141 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 142 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 143 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 144 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 145 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 146 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 147 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 148 | -------------------------------------------------------------------------------- /servant.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE package.yaml #-} 2 | name: {{name}} 3 | version: 0.1.0.0 4 | github: "{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}" 5 | license: BSD-3-Clause 6 | author: "{{author-name}}{{^author-name}}Author name here{{/author-name}}" 7 | maintainer: "{{author-email}}{{^author-email}}example@example.com{{/author-email}}" 8 | copyright: "{{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}}" 9 | 10 | extra-source-files: 11 | - README.md 12 | - CHANGELOG.md 13 | 14 | # Metadata used when publishing your package 15 | # synopsis: Short description of your package 16 | # category: {{category}}{{^category}}Web{{/category}} 17 | 18 | # To avoid duplicated efforts in documentation and dealing with the 19 | # complications of embedding Haddock markup inside cabal files, it is 20 | # common to point users to the README.md file. 21 | description: Please see the README on GitHub at 22 | 23 | dependencies: 24 | - base >= 4.7 && < 5 25 | - aeson 26 | - servant-server 27 | - wai 28 | - warp 29 | 30 | ghc-options: 31 | - -Wall 32 | - -Wcompat 33 | - -Widentities 34 | - -Wincomplete-record-updates 35 | - -Wincomplete-uni-patterns 36 | - -Wmissing-export-lists 37 | - -Wmissing-home-modules 38 | - -Wpartial-fields 39 | - -Wredundant-constraints 40 | 41 | library: 42 | source-dirs: src 43 | 44 | executables: 45 | {{name}}-exe: 46 | main: Main.hs 47 | source-dirs: app 48 | ghc-options: 49 | - -threaded 50 | - -rtsopts 51 | - -with-rtsopts=-N 52 | dependencies: 53 | - base 54 | - {{name}} 55 | 56 | tests: 57 | {{name}}-test: 58 | main: Spec.hs 59 | source-dirs: test 60 | ghc-options: 61 | - -threaded 62 | - -rtsopts 63 | - -with-rtsopts=-N 64 | dependencies: 65 | - base 66 | - {{name}} 67 | - hspec 68 | - hspec-wai 69 | - hspec-wai-json 70 | - aeson 71 | 72 | {-# START_FILE Setup.hs #-} 73 | import Distribution.Simple 74 | main = defaultMain 75 | 76 | {-# START_FILE test/Spec.hs #-} 77 | {-# LANGUAGE QuasiQuotes #-} 78 | {-# LANGUAGE OverloadedStrings #-} 79 | module Main (main) where 80 | 81 | import Lib (app) 82 | import Test.Hspec 83 | import Test.Hspec.Wai 84 | 85 | main :: IO () 86 | main = hspec spec 87 | 88 | spec :: Spec 89 | spec = with (return app) $ do 90 | describe "GET /users" $ do 91 | it "responds with 200" $ do 92 | get "/users" `shouldRespondWith` 200 93 | it "responds with [User]" $ do 94 | let users = "[{\"userId\":1,\"userFirstName\":\"Isaac\",\"userLastName\":\"Newton\"},{\"userId\":2,\"userFirstName\":\"Albert\",\"userLastName\":\"Einstein\"}]" 95 | get "/users" `shouldRespondWith` users 96 | 97 | {-# START_FILE src/Lib.hs #-} 98 | {-# LANGUAGE DataKinds #-} 99 | {-# LANGUAGE TemplateHaskell #-} 100 | {-# LANGUAGE TypeOperators #-} 101 | module Lib 102 | ( startApp 103 | , app 104 | ) where 105 | 106 | import Data.Aeson 107 | import Data.Aeson.TH 108 | import Network.Wai 109 | import Network.Wai.Handler.Warp 110 | import Servant 111 | 112 | data User = User 113 | { userId :: Int 114 | , userFirstName :: String 115 | , userLastName :: String 116 | } deriving (Eq, Show) 117 | 118 | $(deriveJSON defaultOptions ''User) 119 | 120 | type API = "users" :> Get '[JSON] [User] 121 | 122 | startApp :: IO () 123 | startApp = run 8080 app 124 | 125 | app :: Application 126 | app = serve api server 127 | 128 | api :: Proxy API 129 | api = Proxy 130 | 131 | server :: Server API 132 | server = return users 133 | 134 | users :: [User] 135 | users = [ User 1 "Isaac" "Newton" 136 | , User 2 "Albert" "Einstein" 137 | ] 138 | 139 | {-# START_FILE app/Main.hs #-} 140 | module Main (main) where 141 | 142 | import Lib 143 | 144 | main :: IO () 145 | main = startApp 146 | 147 | {-# START_FILE README.md #-} 148 | # {{name}} 149 | 150 | {-# START_FILE CHANGELOG.md #-} 151 | # Changelog for `{{ name }}` 152 | 153 | All notable changes to this project will be documented in this file. 154 | 155 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 156 | and this project adheres to the 157 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 158 | 159 | ## Unreleased 160 | 161 | ## 0.1.0.0 - YYYY-MM-DD 162 | 163 | {-# START_FILE LICENSE #-} 164 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 165 | 166 | Redistribution and use in source and binary forms, with or without 167 | modification, are permitted provided that the following conditions are met: 168 | 169 | 1. Redistributions of source code must retain the above copyright notice, this 170 | list of conditions and the following disclaimer. 171 | 172 | 2. Redistributions in binary form must reproduce the above copyright notice, 173 | this list of conditions and the following disclaimer in the documentation 174 | and/or other materials provided with the distribution. 175 | 176 | 3. Neither the name of the copyright holder nor the names of its contributors 177 | may be used to endorse or promote products derived from this software 178 | without specific prior written permission. 179 | 180 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 181 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 182 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 183 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 184 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 185 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 186 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 187 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 188 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 189 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 190 | -------------------------------------------------------------------------------- /gtk4.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE package.yaml #-} 2 | name: {{name}} 3 | version: 0.1.0.0 4 | github: "{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}" 5 | license: BSD-3-Clause 6 | author: "{{author-name}}{{^author-name}}Author name here{{/author-name}}" 7 | maintainer: "{{author-email}}{{^author-email}}example@example.com{{/author-email}}" 8 | copyright: "{{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}}" 9 | 10 | extra-source-files: 11 | - README.md 12 | - CHANGELOG.md 13 | 14 | # Metadata used when publishing your package 15 | # synopsis: Short description of your package 16 | # category: {{category}}{{^category}}Web{{/category}} 17 | 18 | # To avoid duplicated efforts in documentation and dealing with the 19 | # complications of embedding Haddock markup inside cabal files, it is 20 | # common to point users to the README.md file. 21 | description: Please see the README on GitHub at 22 | 23 | dependencies: 24 | - base >= 4.9 && < 5 25 | - gi-gio 26 | - gi-glib 27 | - gi-gobject 28 | - gi-gtk >= 4.0 29 | - haskell-gi-base 30 | - text 31 | 32 | ghc-options: 33 | - -Wall 34 | - -Wcompat 35 | - -Widentities 36 | - -Wincomplete-record-updates 37 | - -Wincomplete-uni-patterns 38 | - -Wmissing-export-lists 39 | - -Wmissing-home-modules 40 | - -Wpartial-fields 41 | - -Wredundant-constraints 42 | 43 | library: 44 | source-dirs: src 45 | 46 | executables: 47 | {{name}}-exe: 48 | main: Main.hs 49 | source-dirs: app 50 | ghc-options: 51 | - -threaded 52 | - -rtsopts 53 | - -with-rtsopts=-N 54 | dependencies: 55 | - {{name}} 56 | 57 | tests: 58 | {{name}}-test: 59 | main: Spec.hs 60 | source-dirs: test 61 | ghc-options: 62 | - -threaded 63 | - -rtsopts 64 | - -with-rtsopts=-N 65 | dependencies: 66 | - {{name}} 67 | 68 | {-# START_FILE Setup.hs #-} 69 | import Distribution.Simple 70 | main = defaultMain 71 | 72 | {-# START_FILE test/Spec.hs #-} 73 | main :: IO () 74 | main = putStrLn "Test suite not yet implemented" 75 | 76 | {-# START_FILE src/Lib.hs #-} 77 | {-# LANGUAGE OverloadedStrings #-} 78 | 79 | module Lib 80 | ( greeting 81 | ) where 82 | 83 | import Data.Text ( Text ) 84 | 85 | greeting :: Text 86 | greeting = "Hello, World!" 87 | 88 | {-# START_FILE app/Main.hs #-} 89 | {-# LANGUAGE ImplicitParams #-} 90 | {-# LANGUAGE OverloadedLabels #-} 91 | {-# LANGUAGE OverloadedRecordDot #-} 92 | {-# LANGUAGE OverloadedStrings #-} 93 | 94 | import Control.Monad ( void ) 95 | import Data.GI.Base ( AttrOp (..), new, set ) 96 | import qualified GI.Gtk as Gtk 97 | 98 | import Lib ( greeting ) 99 | 100 | activate :: Gtk.Application -> IO () 101 | activate app = do 102 | button <- new Gtk.Button 103 | [ #label := "Click me" 104 | , On #clicked ( ?self `set` [ #sensitive := False 105 | , #label := "Thanks for clicking me" 106 | ] 107 | ) 108 | ] 109 | 110 | window <- new Gtk.ApplicationWindow 111 | [ #application := app 112 | , #title := greeting 113 | , #child := button 114 | ] 115 | 116 | window.show 117 | 118 | main :: IO () 119 | main = do 120 | app <- new Gtk.Application 121 | [ #applicationId := "haskell-gi.example" 122 | , On #activate (activate ?self) 123 | ] 124 | void $ app.run Nothing 125 | 126 | {-# START_FILE README.md #-} 127 | # {{name}} 128 | 129 | GTK4 requires certain C libraries. On Windows, these can be obtained with: 130 | 131 | ~~~text 132 | stack exec -- pacman -Syu 133 | stack exec -- pacman -S mingw-w64-x86_64-pkgconf 134 | stack exec -- pacman -S mingw-w64-x86_64-gobject-introspection 135 | stack exec -- pacman -S mingw-w64-x86_64-gtksourceview5 136 | stack exec -- pacman -S mingw-w64-x86_64-gtk4 137 | ~~~ 138 | 139 | {-# START_FILE CHANGELOG.md #-} 140 | # Changelog for `{{ name }}` 141 | 142 | All notable changes to this project will be documented in this file. 143 | 144 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 145 | and this project adheres to the 146 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 147 | 148 | ## Unreleased 149 | 150 | ## 0.1.0.0 - YYYY-MM-DD 151 | 152 | {-# START_FILE LICENSE #-} 153 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 154 | 155 | Redistribution and use in source and binary forms, with or without 156 | modification, are permitted provided that the following conditions are met: 157 | 158 | 1. Redistributions of source code must retain the above copyright notice, this 159 | list of conditions and the following disclaimer. 160 | 161 | 2. Redistributions in binary form must reproduce the above copyright notice, 162 | this list of conditions and the following disclaimer in the documentation 163 | and/or other materials provided with the distribution. 164 | 165 | 3. Neither the name of the copyright holder nor the names of its contributors 166 | may be used to endorse or promote products derived from this software 167 | without specific prior written permission. 168 | 169 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 170 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 171 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 172 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 173 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 174 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 175 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 176 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 177 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 178 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 179 | 180 | {-# START_FILE .gitignore #-} 181 | .stack-work/ 182 | *~ 183 | -------------------------------------------------------------------------------- /quickcheck-test-framework.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 9 | license: BSD-3-Clause 10 | license-file: LICENSE 11 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 12 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 13 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 14 | category: {{category}}{{^category}}Web{{/category}} 15 | build-type: Simple 16 | extra-source-files: README.md 17 | CHANGELOG.md 18 | 19 | library 20 | hs-source-dirs: src 21 | exposed-modules: Lib 22 | build-depends: base >= 4.7 && < 5 23 | default-language: Haskell2010 24 | ghc-options: -Wall 25 | -Wcompat 26 | -Widentities 27 | -Wincomplete-record-updates 28 | -Wincomplete-uni-patterns 29 | -Wmissing-export-lists 30 | -Wmissing-home-modules 31 | -Wpartial-fields 32 | -Wredundant-constraints 33 | 34 | executable {{name}}-exe 35 | hs-source-dirs: app 36 | main-is: Main.hs 37 | build-depends: base 38 | , {{name}} 39 | default-language: Haskell2010 40 | ghc-options: -Wall 41 | -Wcompat 42 | -Widentities 43 | -Wincomplete-record-updates 44 | -Wincomplete-uni-patterns 45 | -Wmissing-export-lists 46 | -Wmissing-home-modules 47 | -Wpartial-fields 48 | -Wredundant-constraints 49 | -threaded 50 | -rtsopts 51 | -with-rtsopts=-N 52 | 53 | test-suite {{name}}-test 54 | type: exitcode-stdio-1.0 55 | hs-source-dirs: test 56 | main-is: Spec.hs 57 | build-depends: base 58 | , {{name}} 59 | , test-framework 60 | , test-framework-quickcheck2 61 | , QuickCheck 62 | default-language: Haskell2010 63 | ghc-options: -Wall 64 | -Wcompat 65 | -Widentities 66 | -Wincomplete-record-updates 67 | -Wincomplete-uni-patterns 68 | -Wmissing-export-lists 69 | -Wmissing-home-modules 70 | -Wpartial-fields 71 | -Wredundant-constraints 72 | -threaded 73 | -rtsopts 74 | -with-rtsopts=-N 75 | 76 | source-repository head 77 | type: git 78 | location: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 79 | 80 | {-# START_FILE Setup.hs #-} 81 | import Distribution.Simple 82 | main = defaultMain 83 | 84 | {-# START_FILE test/Spec.hs #-} 85 | import Test.Framework (defaultMain, testGroup) 86 | import Test.Framework.Providers.QuickCheck2 (testProperty) 87 | 88 | import Test.QuickCheck 89 | 90 | main :: IO () 91 | main = defaultMain tests 92 | 93 | tests = [ 94 | testGroup "Sorting Group 1" [ 95 | testProperty "prop1" prop1, 96 | testProperty "prop2" prop2 97 | ] 98 | ] 99 | 100 | prop1 b = b == False 101 | where types = (b :: Bool) 102 | 103 | prop2 i = i == 42 104 | where types = (i :: Int) 105 | 106 | {-# START_FILE src/Lib.hs #-} 107 | module Lib 108 | ( someFunc 109 | ) where 110 | 111 | someFunc :: IO () 112 | someFunc = putStrLn "someFunc" 113 | 114 | {-# START_FILE app/Main.hs #-} 115 | module Main (main) where 116 | 117 | import Lib 118 | 119 | main :: IO () 120 | main = someFunc 121 | 122 | {-# START_FILE README.md #-} 123 | # {{name}} 124 | 125 | {-# START_FILE CHANGELOG.md #-} 126 | # Changelog for `{{ name }}` 127 | 128 | All notable changes to this project will be documented in this file. 129 | 130 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 131 | and this project adheres to the 132 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 133 | 134 | ## Unreleased 135 | 136 | ## 0.1.0.0 - YYYY-MM-DD 137 | 138 | {-# START_FILE LICENSE #-} 139 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 140 | 141 | Redistribution and use in source and binary forms, with or without 142 | modification, are permitted provided that the following conditions are met: 143 | 144 | 1. Redistributions of source code must retain the above copyright notice, this 145 | list of conditions and the following disclaimer. 146 | 147 | 2. Redistributions in binary form must reproduce the above copyright notice, 148 | this list of conditions and the following disclaimer in the documentation 149 | and/or other materials provided with the distribution. 150 | 151 | 3. Neither the name of the copyright holder nor the names of its contributors 152 | may be used to endorse or promote products derived from this software 153 | without specific prior written permission. 154 | 155 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 156 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 157 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 158 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 159 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 160 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 161 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 162 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 163 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 164 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 165 | -------------------------------------------------------------------------------- /hspec.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 9 | license: BSD-3-Clause 10 | license-file: LICENSE 11 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 12 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 13 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 14 | category: {{category}}{{^category}}Web{{/category}} 15 | build-type: Simple 16 | extra-source-files: README.md 17 | CHANGELOG.md 18 | 19 | library 20 | hs-source-dirs: src 21 | exposed-modules: Data.String.Strip 22 | build-depends: base >= 4.7 && < 5 23 | default-language: Haskell2010 24 | ghc-options: -Wall 25 | -Wcompat 26 | -Widentities 27 | -Wincomplete-record-updates 28 | -Wincomplete-uni-patterns 29 | -Wmissing-export-lists 30 | -Wmissing-home-modules 31 | -Wpartial-fields 32 | -Wredundant-constraints 33 | 34 | executable {{name}} 35 | hs-source-dirs: app 36 | main-is: Main.hs 37 | build-depends: base 38 | , {{name}} 39 | default-language: Haskell2010 40 | ghc-options: -Wall 41 | -Wcompat 42 | -Widentities 43 | -Wincomplete-record-updates 44 | -Wincomplete-uni-patterns 45 | -Wmissing-export-lists 46 | -Wmissing-home-modules 47 | -Wpartial-fields 48 | -Wredundant-constraints 49 | -threaded 50 | -rtsopts 51 | -with-rtsopts=-N 52 | 53 | test-suite {{name}}-test 54 | type: exitcode-stdio-1.0 55 | hs-source-dirs: test 56 | main-is: Spec.hs 57 | other-modules: Data.String.StripSpec 58 | build-depends: base 59 | , {{name}} 60 | , hspec 61 | , QuickCheck 62 | default-language: Haskell2010 63 | ghc-options: -Wall 64 | -Wcompat 65 | -Widentities 66 | -Wincomplete-record-updates 67 | -Wincomplete-uni-patterns 68 | -Wmissing-export-lists 69 | -Wmissing-home-modules 70 | -Wpartial-fields 71 | -Wredundant-constraints 72 | -threaded 73 | -rtsopts 74 | -with-rtsopts=-N 75 | 76 | source-repository head 77 | type: git 78 | location: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 79 | 80 | {-# START_FILE Setup.hs #-} 81 | import Distribution.Simple 82 | main = defaultMain 83 | 84 | {-# START_FILE test/Spec.hs #-} 85 | {-# OPTIONS_GHC -F -pgmF hspec-discover #-} 86 | 87 | {-# START_FILE test/Data/String/StripSpec.hs #-} 88 | module Data.String.StripSpec (main, spec) where 89 | 90 | import Test.Hspec 91 | import Test.QuickCheck 92 | 93 | import Data.String.Strip 94 | 95 | -- `main` is here so that this module can be run from GHCi on its own. It is 96 | -- not needed for automatic spec discovery. 97 | main :: IO () 98 | main = hspec spec 99 | 100 | spec :: Spec 101 | spec = do 102 | describe "strip" $ do 103 | it "removes leading and trailing whitespace" $ do 104 | strip "\t foo bar\n" `shouldBe` "foo bar" 105 | it "is idempotent" $ property $ 106 | \str -> strip str === strip (strip str) 107 | 108 | {-# START_FILE src/Data/String/Strip.hs #-} 109 | module Data.String.Strip (strip) where 110 | 111 | import Data.Char 112 | 113 | strip :: String -> String 114 | strip = dropWhile isSpace . reverse . dropWhile isSpace . reverse 115 | 116 | {-# START_FILE app/Main.hs #-} 117 | module Main (main) where 118 | 119 | import Data.String.Strip 120 | 121 | main :: IO () 122 | main = interact strip 123 | 124 | {-# START_FILE README.md #-} 125 | # {{name}} 126 | 127 | add description of {{name}} here 128 | 129 | {-# START_FILE CHANGELOG.md #-} 130 | # Changelog for `{{ name }}` 131 | 132 | All notable changes to this project will be documented in this file. 133 | 134 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 135 | and this project adheres to the 136 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 137 | 138 | ## Unreleased 139 | 140 | ## 0.1.0.0 - YYYY-MM-DD 141 | 142 | {-# START_FILE LICENSE #-} 143 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 144 | 145 | Redistribution and use in source and binary forms, with or without 146 | modification, are permitted provided that the following conditions are met: 147 | 148 | 1. Redistributions of source code must retain the above copyright notice, this 149 | list of conditions and the following disclaimer. 150 | 151 | 2. Redistributions in binary form must reproduce the above copyright notice, 152 | this list of conditions and the following disclaimer in the documentation 153 | and/or other materials provided with the distribution. 154 | 155 | 3. Neither the name of the copyright holder nor the names of its contributors 156 | may be used to endorse or promote products derived from this software 157 | without specific prior written permission. 158 | 159 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 160 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 161 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 162 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 163 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 164 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 165 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 166 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 167 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 168 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 169 | -------------------------------------------------------------------------------- /protolude.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 9 | license: BSD-3-Clause 10 | license-file: LICENSE 11 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 12 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 13 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 14 | category: {{category}}{{^category}}Web{{/category}} 15 | build-type: Simple 16 | extra-source-files: README.md 17 | CHANGELOG.md 18 | 19 | library 20 | hs-source-dirs: src 21 | exposed-modules: Lib 22 | other-modules: Lib.Prelude 23 | build-depends: base >= 4.7 && < 5 24 | , protolude >= 0.1.6 && < 0.4 25 | default-language: Haskell2010 26 | default-extensions: OverloadedStrings, NoImplicitPrelude 27 | ghc-options: -Wall 28 | -Wcompat 29 | -Widentities 30 | -Wincomplete-record-updates 31 | -Wincomplete-uni-patterns 32 | -Wmissing-export-lists 33 | -Wmissing-home-modules 34 | -Wpartial-fields 35 | -Wredundant-constraints 36 | 37 | executable {{name}}-exe 38 | hs-source-dirs: app 39 | main-is: Main.hs 40 | build-depends: base 41 | , {{name}} 42 | , protolude >= 0.1.6 && < 0.4 43 | default-language: Haskell2010 44 | default-extensions: OverloadedStrings, NoImplicitPrelude 45 | ghc-options: -Wall 46 | -Wcompat 47 | -Widentities 48 | -Wincomplete-record-updates 49 | -Wincomplete-uni-patterns 50 | -Wmissing-export-lists 51 | -Wmissing-home-modules 52 | -Wpartial-fields 53 | -Wredundant-constraints 54 | -threaded 55 | -rtsopts 56 | -with-rtsopts=-N 57 | 58 | test-suite {{name}}-test 59 | type: exitcode-stdio-1.0 60 | hs-source-dirs: test 61 | main-is: Spec.hs 62 | build-depends: base 63 | , {{name}} 64 | , protolude >= 0.1.6 && < 0.4 65 | default-language: Haskell2010 66 | default-extensions: OverloadedStrings, NoImplicitPrelude 67 | ghc-options: -Wall 68 | -Wcompat 69 | -Widentities 70 | -Wincomplete-record-updates 71 | -Wincomplete-uni-patterns 72 | -Wmissing-export-lists 73 | -Wmissing-home-modules 74 | -Wpartial-fields 75 | -Wredundant-constraints 76 | -threaded 77 | -rtsopts 78 | -with-rtsopts=-N 79 | 80 | source-repository head 81 | type: git 82 | location: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 83 | 84 | {-# START_FILE Setup.hs #-} 85 | import Distribution.Simple 86 | main = defaultMain 87 | 88 | {-# START_FILE test/Spec.hs #-} 89 | import Protolude 90 | 91 | main :: IO () 92 | main = putStrLn ("Test suite not yet implemented" :: Text) 93 | 94 | {-# START_FILE src/Lib/Prelude.hs #-} 95 | {- 96 | Welcome to your custom Prelude 97 | Export here everything that should always be in your library scope 98 | For more info on what is exported by Protolude check: 99 | https://github.com/sdiehl/protolude/blob/master/Symbols.md 100 | -} 101 | module Lib.Prelude 102 | ( module Exports 103 | ) where 104 | 105 | import Protolude as Exports 106 | 107 | {-# START_FILE src/Lib.hs #-} 108 | {-| 109 | Module : Lib 110 | Description : Lib's main module 111 | 112 | This is a haddock comment describing your library 113 | For more information on how to write Haddock comments check the user guide: 114 | 115 | -} 116 | module Lib 117 | ( someFunc 118 | ) where 119 | 120 | import Lib.Prelude 121 | 122 | -- | Prints someFunc 123 | -- 124 | -- >>> someFunc 10 125 | -- someFunc 126 | someFunc :: IO () 127 | someFunc = putStrLn ("someFunc" :: Text) 128 | 129 | {-# START_FILE app/Main.hs #-} 130 | module Main (main) where 131 | 132 | import Protolude 133 | import Lib 134 | 135 | main :: IO () 136 | main = someFunc 137 | 138 | {-# START_FILE README.md #-} 139 | # {{name}} 140 | 141 | add description of {{name}} here 142 | 143 | {-# START_FILE CHANGELOG.md #-} 144 | # Changelog for `{{ name }}` 145 | 146 | All notable changes to this project will be documented in this file. 147 | 148 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 149 | and this project adheres to the 150 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 151 | 152 | ## Unreleased 153 | 154 | ## 0.1.0.0 - YYYY-MM-DD 155 | 156 | {-# START_FILE LICENSE #-} 157 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 158 | 159 | Redistribution and use in source and binary forms, with or without 160 | modification, are permitted provided that the following conditions are met: 161 | 162 | 1. Redistributions of source code must retain the above copyright notice, this 163 | list of conditions and the following disclaimer. 164 | 165 | 2. Redistributions in binary form must reproduce the above copyright notice, 166 | this list of conditions and the following disclaimer in the documentation 167 | and/or other materials provided with the distribution. 168 | 169 | 3. Neither the name of the copyright holder nor the names of its contributors 170 | may be used to endorse or promote products derived from this software 171 | without specific prior written permission. 172 | 173 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 174 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 175 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 176 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 177 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 178 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 179 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 180 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 181 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 182 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 183 | -------------------------------------------------------------------------------- /servant-docker.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE package.yaml #-} 2 | name: {{name}} 3 | version: 0.1.0.0 4 | github: "{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}" 5 | license: BSD-3-Clause 6 | author: "{{author-name}}{{^author-name}}Author name here{{/author-name}}" 7 | maintainer: "{{author-email}}{{^author-email}}example@example.com{{/author-email}}" 8 | copyright: "{{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}}" 9 | 10 | extra-source-files: 11 | - README.md 12 | - CHANGELOG.md 13 | 14 | # Metadata used when publishing your package 15 | # synopsis: Short description of your package 16 | # category: {{category}}{{^category}}Web{{/category}} 17 | 18 | # To avoid duplicated efforts in documentation and dealing with the 19 | # complications of embedding Haddock markup inside cabal files, it is 20 | # common to point users to the README.md file. 21 | description: Please see the README on GitHub at 22 | 23 | dependencies: 24 | - base >= 4.7 && < 5 25 | - aeson 26 | - servant-server 27 | - wai 28 | - warp 29 | 30 | ghc-options: 31 | - -Wall 32 | - -Wcompat 33 | - -Widentities 34 | - -Wincomplete-record-updates 35 | - -Wincomplete-uni-patterns 36 | - -Wmissing-export-lists 37 | - -Wmissing-home-modules 38 | - -Wpartial-fields 39 | - -Wredundant-constraints 40 | 41 | library: 42 | source-dirs: src 43 | 44 | executables: 45 | {{name}}-exe: 46 | main: Main.hs 47 | source-dirs: app 48 | ghc-options: 49 | - -threaded 50 | - -rtsopts 51 | - -with-rtsopts=-N 52 | dependencies: 53 | - base 54 | - {{name}} 55 | 56 | tests: 57 | {{name}}-test: 58 | main: Spec.hs 59 | source-dirs: test 60 | ghc-options: 61 | - -threaded 62 | - -rtsopts 63 | - -with-rtsopts=-N 64 | dependencies: 65 | - base 66 | - {{name}} 67 | 68 | {-# START_FILE Setup.hs #-} 69 | import Distribution.Simple 70 | main = defaultMain 71 | 72 | {-# START_FILE test/Spec.hs #-} 73 | main :: IO () 74 | main = putStrLn "Test suite not yet implemented" 75 | 76 | {-# START_FILE src/Lib.hs #-} 77 | {-# LANGUAGE DataKinds #-} 78 | {-# LANGUAGE TemplateHaskell #-} 79 | {-# LANGUAGE TypeOperators #-} 80 | module Lib 81 | ( startApp 82 | ) where 83 | 84 | import Data.Aeson 85 | import Data.Aeson.TH 86 | import Network.Wai 87 | import Network.Wai.Handler.Warp 88 | import Servant 89 | 90 | data User = User 91 | { userId :: Int 92 | , userFirstName :: String 93 | , userLastName :: String 94 | } deriving (Eq, Show) 95 | 96 | $(deriveJSON defaultOptions ''User) 97 | 98 | type API = "users" :> Get '[JSON] [User] 99 | 100 | startApp :: IO () 101 | startApp = run 1234 app 102 | 103 | app :: Application 104 | app = serve api server 105 | 106 | api :: Proxy API 107 | api = Proxy 108 | 109 | server :: Server API 110 | server = return users 111 | 112 | users :: [User] 113 | users = [ User 1 "Isaac" "Newton" 114 | , User 2 "Albert" "Einstein" 115 | , User 3 "Stephen" "Hawking" 116 | ] 117 | 118 | {-# START_FILE app/Main.hs #-} 119 | module Main (main) where 120 | 121 | import Lib 122 | 123 | main :: IO () 124 | main = startApp 125 | 126 | {-# START_FILE README.md #-} 127 | # {{name}} 128 | 129 | {-# START_FILE CHANGELOG.md #-} 130 | # Changelog for `{{ name }}` 131 | 132 | All notable changes to this project will be documented in this file. 133 | 134 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 135 | and this project adheres to the 136 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 137 | 138 | ## Unreleased 139 | 140 | ## 0.1.0.0 - YYYY-MM-DD 141 | 142 | {-# START_FILE LICENSE #-} 143 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 144 | 145 | Redistribution and use in source and binary forms, with or without 146 | modification, are permitted provided that the following conditions are met: 147 | 148 | 1. Redistributions of source code must retain the above copyright notice, this 149 | list of conditions and the following disclaimer. 150 | 151 | 2. Redistributions in binary form must reproduce the above copyright notice, 152 | this list of conditions and the following disclaimer in the documentation 153 | and/or other materials provided with the distribution. 154 | 155 | 3. Neither the name of the copyright holder nor the names of its contributors 156 | may be used to endorse or promote products derived from this software 157 | without specific prior written permission. 158 | 159 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 160 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 161 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 162 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 163 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 164 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 165 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 166 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 167 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 168 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 169 | 170 | {-# START_FILE docker-compose.yml #-} 171 | version: '3' 172 | services: 173 | {{name}}: 174 | build: . 175 | image: {{name}} 176 | command: {{name}} 177 | expose: 178 | - "1234" 179 | nginx: 180 | build: ./nginx 181 | image: nginx 182 | ports: 183 | - "8080:80" 184 | depends_on: 185 | - {{name}} 186 | 187 | {-# START_FILE Dockerfile #-} 188 | FROM haskell:8.2.2 189 | 190 | RUN mkdir -p /app/user 191 | WORKDIR /app/user 192 | COPY stack.yaml *.cabal ./ 193 | 194 | RUN export PATH=$(stack path --local-bin):$PATH 195 | RUN stack build --dependencies-only 196 | 197 | COPY . /app/user 198 | RUN stack install 199 | 200 | {-# START_FILE nginx/Dockerfile #-} 201 | FROM nginx 202 | RUN rm -v /etc/nginx/nginx.conf 203 | ADD nginx.conf /etc/nginx 204 | CMD service nginx start 205 | {-# START_FILE nginx/nginx.conf #-} 206 | daemon off; 207 | 208 | user nginx; 209 | worker_processes 1; 210 | 211 | error_log /var/log/nginx/error.log warn; 212 | pid /var/run/nginx.pid; 213 | 214 | 215 | events { 216 | worker_connections 1024; 217 | } 218 | 219 | 220 | http { 221 | include /etc/nginx/mime.types; 222 | default_type application/octet-stream; 223 | 224 | sendfile on; 225 | 226 | upstream app { 227 | server {{name}}:1234; 228 | } 229 | 230 | server { 231 | listen 80; 232 | server_name localhost; 233 | 234 | location / { 235 | proxy_pass http://app/; 236 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 237 | proxy_set_header Host $http_host; 238 | proxy_redirect off; 239 | } 240 | } 241 | } 242 | -------------------------------------------------------------------------------- /haskeleton.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE package.yaml #-} 2 | # This YAML file describes your package. Stack will automatically generate a 3 | # Cabal file when you run `stack build`. See the hpack website for help with 4 | # this file: . 5 | name: {{ name }} 6 | version: '0.0.0' 7 | github: "{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}" 8 | license: MIT 9 | author: "{{author-name}}{{^author-name}}Author name here{{/author-name}}" 10 | maintainer: "{{author-name}}{{^author-name}}Author name here{{/author-name}}" 11 | # synopsis: A new Haskeleton package. 12 | # description: {{ name }} is a new Haskeleton package. 13 | # category: Other 14 | 15 | extra-source-files: 16 | - CHANGELOG.md 17 | - LICENSE.md 18 | - package.yaml 19 | - README.md 20 | - stack.yaml 21 | 22 | ghc-options: 23 | - -Wall 24 | - -Wcompat 25 | - -Widentities 26 | - -Wincomplete-record-updates 27 | - -Wincomplete-uni-patterns 28 | - -Wmissing-export-lists 29 | - -Wmissing-home-modules 30 | - -Wpartial-fields 31 | - -Wredundant-constraints 32 | 33 | library: 34 | dependencies: 35 | - base 36 | source-dirs: library 37 | 38 | executables: 39 | {{ name }}: 40 | source-dirs: executable 41 | main: Main.hs 42 | dependencies: 43 | - base 44 | - {{ name }} 45 | ghc-options: 46 | - -rtsopts 47 | - -threaded 48 | - -with-rtsopts=-N 49 | 50 | benchmarks: 51 | {{ name }}-benchmarks: 52 | source-dirs: benchmark 53 | main: Main.hs 54 | dependencies: 55 | - base 56 | - {{ name }} 57 | - criterion 58 | ghc-options: 59 | - -rtsopts 60 | - -threaded 61 | - -with-rtsopts=-N 62 | 63 | tests: 64 | {{ name }}-test-suite: 65 | source-dirs: test-suite 66 | main: Main.hs 67 | dependencies: 68 | - base 69 | - {{ name }} 70 | - hspec 71 | - tasty 72 | - tasty-hspec 73 | ghc-options: 74 | - -rtsopts 75 | - -threaded 76 | - -with-rtsopts=-N 77 | 78 | {-# START_FILE Setup.hs #-} 79 | -- This script is used to build and install your package. Typically you don't 80 | -- need to change it. The Cabal documentation has more information about this 81 | -- file: . 82 | import qualified Distribution.Simple 83 | 84 | main :: IO () 85 | main = Distribution.Simple.defaultMain 86 | 87 | {-# START_FILE benchmark/Main.hs #-} 88 | -- You can benchmark your code quickly and effectively with Criterion. See its 89 | -- website for help: . 90 | import Criterion.Main 91 | 92 | main :: IO () 93 | main = defaultMain [bench "const" (whnf const ())] 94 | 95 | {-# START_FILE executable/Main.hs #-} 96 | -- It is generally a good idea to keep all your business logic in your library 97 | -- and only use it in the executable. Doing so allows others to use what you 98 | -- wrote in their libraries. 99 | import qualified Example 100 | 101 | main :: IO () 102 | main = Example.main 103 | 104 | {-# START_FILE library/Example.hs #-} 105 | -- | An example module. 106 | module Example (main) where 107 | 108 | -- | An example function. 109 | main :: IO () 110 | main = return () 111 | 112 | {-# START_FILE test-suite/Main.hs #-} 113 | -- Tasty makes it easy to test your code. It is a test framework that can 114 | -- combine many different types of tests into one suite. See its website for 115 | -- help: . 116 | import qualified Test.Tasty 117 | -- Hspec is one of the providers for Tasty. It provides a nice syntax for 118 | -- writing tests. Its website has more info: . 119 | import Test.Tasty.Hspec 120 | import Test.Hspec 121 | 122 | main :: IO () 123 | main = do 124 | test <- testSpec "{{ name }}" spec 125 | Test.Tasty.defaultMain test 126 | 127 | spec :: Spec 128 | spec = parallel $ do 129 | it "is trivially true" $ do 130 | True `shouldBe` True 131 | 132 | {-# START_FILE CHANGELOG.md #-} 133 | # Change log 134 | 135 | {{ name }} uses [Semantic Versioning][]. 136 | The change log is available through the [releases on GitHub][]. 137 | 138 | [Semantic Versioning]: http://semver.org/spec/v2.0.0.html 139 | [releases on GitHub]: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{ name }}/releases 140 | 141 | {-# START_FILE README.md #-} 142 | # [{{ name }}][] 143 | 144 | Thanks for starting a project with Haskeleton! If you haven't heard of it 145 | before, I suggest reading the introductory blog post. You can find it here: 146 | . 147 | 148 | Before you get started, there are a few things that this template couldn't 149 | provide for you. You should: 150 | 151 | - Add a synopsis to `package.yaml`. It should be a short (one sentence) 152 | explanation of your project. 153 | 154 | - Add a description to `package.yaml`. This can be whatever you want it to 155 | be. 156 | 157 | - Add a category to `package.yaml`. A list of categories is available on 158 | Hackage at . 159 | 160 | - Rename `library/Example.hs` to whatever you want your top-level module to 161 | be called. Typically this is the same as your package name but in 162 | `CamelCase` instead of `kebab-case`. 163 | 164 | - Don't forget to rename the reference to it in 165 | `executable/Main.hs`! 166 | 167 | - If you are on an older version of Stack (<1.0.4), delete `package.yaml` and 168 | remove `/*.cabal` from your `.gitignore`. 169 | 170 | Once you've done that, start working on your project with the Stack commands 171 | you know and love. 172 | 173 | ``` sh 174 | # Build the project. 175 | stack build 176 | 177 | # Run the test suite. 178 | stack test 179 | 180 | # Run the benchmarks. 181 | stack bench 182 | 183 | # Generate documentation. 184 | stack haddock 185 | ``` 186 | 187 | Thanks again, and happy hacking! 188 | 189 | [{{ name }}]: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{ name }} 190 | 191 | {-# START_FILE LICENSE.md #-} 192 | [The MIT License (MIT)][] 193 | 194 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 195 | 196 | Permission is hereby granted, free of charge, to any person obtaining a copy of 197 | this software and associated documentation files (the "Software"), to deal in 198 | the Software without restriction, including without limitation the rights to 199 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 200 | of the Software, and to permit persons to whom the Software is furnished to do 201 | so, subject to the following conditions: 202 | 203 | The above copyright notice and this permission notice shall be included in all 204 | copies or substantial portions of the Software. 205 | 206 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 207 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 208 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 209 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 210 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 211 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 212 | SOFTWARE. 213 | 214 | [The MIT License (MIT)]: https://opensource.org/licenses/MIT 215 | 216 | {-# START_FILE .gitignore #-} 217 | # Stack uses this directory as scratch space. 218 | /.stack-work/ 219 | # Stack generates the Cabal file from `package.yaml` through hpack. 220 | /*.cabal 221 | -------------------------------------------------------------------------------- /rio.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE package.yaml #-} 2 | name: {{name}} 3 | version: 0.1.0.0 4 | github: {{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 5 | license: BSD-3-Clause 6 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 7 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 8 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 9 | 10 | extra-source-files: 11 | - README.md 12 | - CHANGELOG.md 13 | 14 | # Metadata used when publishing your package 15 | # synopsis: Short description of your package 16 | # category: Web 17 | 18 | # To avoid duplicated efforts in documentation and dealing with the 19 | # complications of embedding Haddock markup inside cabal files, it is 20 | # common to point users to the README.md file. 21 | description: Please see the README on Github at 22 | 23 | dependencies: 24 | - base >= 4.11 && < 10 25 | - rio >= 0.1.12.0 26 | 27 | ghc-options: 28 | - -Wall 29 | - -Wcompat 30 | - -Widentities 31 | - -Wincomplete-record-updates 32 | - -Wincomplete-uni-patterns 33 | - -Wmissing-export-lists 34 | - -Wmissing-home-modules 35 | - -Wpartial-fields 36 | - -Wredundant-constraints 37 | 38 | library: 39 | source-dirs: src 40 | 41 | executables: 42 | {{name}}-exe: 43 | main: Main.hs 44 | source-dirs: app 45 | dependencies: 46 | - {{name}} 47 | - optparse-simple 48 | 49 | ghc-options: 50 | - -threaded 51 | - -rtsopts 52 | - -with-rtsopts=-N 53 | 54 | tests: 55 | {{name}}-test: 56 | main: Spec.hs 57 | source-dirs: test 58 | dependencies: 59 | - {{name}} 60 | - hspec 61 | 62 | ghc-options: 63 | - -threaded 64 | - -rtsopts 65 | - -with-rtsopts=-N 66 | 67 | {-# START_FILE Setup.hs #-} 68 | import Distribution.Simple 69 | main = defaultMain 70 | 71 | {-# START_FILE app/Main.hs #-} 72 | {-# LANGUAGE NoImplicitPrelude #-} 73 | {-# LANGUAGE TemplateHaskell #-} 74 | module Main (main) where 75 | 76 | import Import 77 | import Run 78 | import RIO.Process 79 | import Options.Applicative.Simple 80 | import qualified Paths_{{name-as-varid}} 81 | 82 | main :: IO () 83 | main = do 84 | (options, ()) <- simpleOptions 85 | $(simpleVersion Paths_{{name-as-varid}}.version) 86 | "Header for command line arguments" 87 | "Program description, also for command line arguments" 88 | (Options 89 | <$> switch ( long "verbose" 90 | <> short 'v' 91 | <> help "Verbose output?" 92 | ) 93 | ) 94 | empty 95 | lo <- logOptionsHandle stderr (optionsVerbose options) 96 | pc <- mkDefaultProcessContext 97 | withLogFunc lo $ \lf -> 98 | let app = App 99 | { appLogFunc = lf 100 | , appProcessContext = pc 101 | , appOptions = options 102 | } 103 | in runRIO app run 104 | 105 | {-# START_FILE src/Import.hs #-} 106 | {-# LANGUAGE NoImplicitPrelude #-} 107 | module Import 108 | ( module RIO 109 | , module Types 110 | ) where 111 | 112 | import RIO 113 | import Types 114 | 115 | {-# START_FILE src/Run.hs #-} 116 | {-# LANGUAGE NoImplicitPrelude #-} 117 | {-# LANGUAGE OverloadedStrings #-} 118 | module Run (run) where 119 | 120 | import Import 121 | 122 | run :: RIO App () 123 | run = do 124 | logInfo "We're inside the application!" 125 | 126 | {-# START_FILE src/Types.hs #-} 127 | {-# LANGUAGE NoImplicitPrelude #-} 128 | module Types 129 | ( App (..) 130 | , Options (..) 131 | ) where 132 | 133 | import RIO 134 | import RIO.Process 135 | 136 | -- | Command line arguments 137 | data Options = Options 138 | { optionsVerbose :: !Bool 139 | } 140 | 141 | data App = App 142 | { appLogFunc :: !LogFunc 143 | , appProcessContext :: !ProcessContext 144 | , appOptions :: !Options 145 | -- Add other app-specific configuration information here 146 | } 147 | 148 | instance HasLogFunc App where 149 | logFuncL = lens appLogFunc (\x y -> x { appLogFunc = y }) 150 | instance HasProcessContext App where 151 | processContextL = lens appProcessContext (\x y -> x { appProcessContext = y }) 152 | 153 | {-# START_FILE src/Util.hs #-} 154 | {-# LANGUAGE NoImplicitPrelude #-} 155 | -- | Silly utility module, used to demonstrate how to write a test 156 | -- case. 157 | module Util 158 | ( plus2 159 | ) where 160 | 161 | import RIO 162 | 163 | plus2 :: Int -> Int 164 | plus2 = (+ 2) 165 | 166 | {-# START_FILE test/Spec.hs #-} 167 | {-# OPTIONS_GHC -F -pgmF hspec-discover #-} 168 | 169 | {-# START_FILE test/UtilSpec.hs #-} 170 | {-# LANGUAGE NoImplicitPrelude #-} 171 | module UtilSpec (spec) where 172 | 173 | import Import 174 | import Util 175 | import Test.Hspec 176 | import Test.Hspec.QuickCheck 177 | 178 | spec :: Spec 179 | spec = do 180 | describe "plus2" $ do 181 | it "basic check" $ plus2 0 `shouldBe` 2 182 | it "overflow" $ plus2 maxBound `shouldBe` minBound + 1 183 | prop "minus 2" $ \i -> plus2 i - 2 `shouldBe` i 184 | 185 | {-# START_FILE README.md #-} 186 | # {{name}} 187 | 188 | ## Execute 189 | 190 | * Run `stack exec -- {{name}}-exe` to see "We're inside the application!" 191 | * With `stack exec -- {{name}}-exe --verbose` you will see the same message, with more logging. 192 | 193 | ## Run tests 194 | 195 | `stack test` 196 | 197 | {-# START_FILE CHANGELOG.md #-} 198 | # Changelog for `{{ name }}` 199 | 200 | All notable changes to this project will be documented in this file. 201 | 202 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 203 | and this project adheres to the 204 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 205 | 206 | ## Unreleased 207 | 208 | ## 0.1.0.0 - YYYY-MM-DD 209 | 210 | {-# START_FILE LICENSE #-} 211 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 212 | 213 | Redistribution and use in source and binary forms, with or without 214 | modification, are permitted provided that the following conditions are met: 215 | 216 | 1. Redistributions of source code must retain the above copyright notice, this 217 | list of conditions and the following disclaimer. 218 | 219 | 2. Redistributions in binary form must reproduce the above copyright notice, 220 | this list of conditions and the following disclaimer in the documentation 221 | and/or other materials provided with the distribution. 222 | 223 | 3. Neither the name of the copyright holder nor the names of its contributors 224 | may be used to endorse or promote products derived from this software 225 | without specific prior written permission. 226 | 227 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 228 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 229 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 230 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 231 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 232 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 233 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 234 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 235 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 236 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 237 | 238 | {-# START_FILE .gitignore #-} 239 | *~ 240 | *.swp 241 | tarballs/ 242 | .stack-work/ 243 | -------------------------------------------------------------------------------- /franklinchen.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 9 | license: BSD-3-Clause 10 | license-file: LICENSE 11 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 12 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 13 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 14 | category: {{category}}{{^category}}Acme{{/category}} 15 | build-type: Simple 16 | extra-source-files: README.md 17 | CHANGELOG.md 18 | tested-with: GHC == 7.10.2 19 | 20 | library 21 | default-language: Haskell2010 22 | hs-source-dirs: src 23 | exposed-modules: Lib 24 | build-depends: base >= 4.7 && < 5 25 | ghc-options: -Wall 26 | -Wcompat 27 | -Widentities 28 | -Wincomplete-record-updates 29 | -Wincomplete-uni-patterns 30 | -Wmissing-export-lists 31 | -Wmissing-home-modules 32 | -Wpartial-fields 33 | -Wredundant-constraints 34 | 35 | executable {{name}} 36 | default-language: Haskell2010 37 | hs-source-dirs: app 38 | main-is: Main.hs 39 | build-depends: base 40 | , {{name}} 41 | ghc-options: -Wall 42 | -Wcompat 43 | -Widentities 44 | -Wincomplete-record-updates 45 | -Wincomplete-uni-patterns 46 | -Wmissing-export-lists 47 | -Wmissing-home-modules 48 | -Wpartial-fields 49 | -Wredundant-constraints 50 | -threaded 51 | -rtsopts 52 | -with-rtsopts=-N 53 | 54 | test-suite spec 55 | default-language: Haskell2010 56 | type: exitcode-stdio-1.0 57 | hs-source-dirs: test 58 | main-is: Spec.hs 59 | other-modules: LibSpec 60 | build-depends: base 61 | , {{name}} 62 | , hspec 63 | , QuickCheck 64 | ghc-options: -Wall 65 | -Wcompat 66 | -Widentities 67 | -Wincomplete-record-updates 68 | -Wincomplete-uni-patterns 69 | -Wmissing-export-lists 70 | -Wmissing-home-modules 71 | -Wpartial-fields 72 | -Wredundant-constraints 73 | 74 | source-repository head 75 | type: git 76 | location: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 77 | 78 | {-# START_FILE Setup.hs #-} 79 | import Distribution.Simple 80 | main = defaultMain 81 | 82 | {-# START_FILE test/Spec.hs #-} 83 | {-# OPTIONS_GHC -F -pgmF hspec-discover #-} 84 | 85 | {-# START_FILE test/LibSpec.hs #-} 86 | module LibSpec 87 | ( main 88 | , spec 89 | ) where 90 | 91 | import Test.Hspec 92 | import Test.Hspec.QuickCheck 93 | 94 | import Lib (ourAdd) 95 | 96 | main :: IO () 97 | main = hspec spec 98 | 99 | spec :: Spec 100 | spec = 101 | describe "Lib" $ do 102 | it "works" $ do 103 | True `shouldBe` True 104 | prop "ourAdd is commutative" $ \x y -> 105 | ourAdd x y `shouldBe` ourAdd y x 106 | 107 | {-# START_FILE src/Lib.hs #-} 108 | -- | A library to do stuff. 109 | module Lib 110 | ( 111 | ourAdd 112 | ) where 113 | 114 | -- | Add two 'Int' values. 115 | ourAdd :: Int -- ^ left 116 | -> Int -- ^ right 117 | -> Int -- ^ sum 118 | ourAdd x y = x + y 119 | 120 | {-# START_FILE app/Main.hs #-} 121 | module Main (main) where 122 | 123 | import Lib (ourAdd) 124 | 125 | import Text.Printf (printf) 126 | 127 | main :: IO () 128 | main = printf "2 + 3 = %d\n" (ourAdd 2 3) 129 | 130 | {-# START_FILE README.md #-} 131 | # {{name}} 132 | 133 | [![Build Status](https://travis-ci.org/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}.png)](https://travis-ci.org/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}) 134 | 135 | TODO Description. 136 | 137 | {-# START_FILE CHANGELOG.md #-} 138 | # Changelog for `{{ name }}` 139 | 140 | All notable changes to this project will be documented in this file. 141 | 142 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 143 | and this project adheres to the 144 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 145 | 146 | ## Unreleased 147 | 148 | ## 0.1.0.0 - YYYY-MM-DD 149 | 150 | {-# START_FILE LICENSE #-} 151 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 152 | 153 | Redistribution and use in source and binary forms, with or without 154 | modification, are permitted provided that the following conditions are met: 155 | 156 | 1. Redistributions of source code must retain the above copyright notice, this 157 | list of conditions and the following disclaimer. 158 | 159 | 2. Redistributions in binary form must reproduce the above copyright notice, 160 | this list of conditions and the following disclaimer in the documentation 161 | and/or other materials provided with the distribution. 162 | 163 | 3. Neither the name of the copyright holder nor the names of its contributors 164 | may be used to endorse or promote products derived from this software 165 | without specific prior written permission. 166 | 167 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 168 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 169 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 170 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 171 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 172 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 173 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 174 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 175 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 176 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 177 | 178 | {-# START_FILE .gitignore #-} 179 | /dist/ 180 | /.cabal-sandbox/ 181 | /cabal.sandbox.config 182 | /.stack-work/ 183 | 184 | {-# START_FILE .travis.yml #-} 185 | # Use new container infrastructure to enable caching 186 | sudo: false 187 | 188 | # Choose a lightweight base image; we provide our own build tools. 189 | language: c 190 | 191 | # GHC depends on GMP. You can add other dependencies here as well. 192 | addons: 193 | apt: 194 | packages: 195 | - libgmp-dev 196 | 197 | # The different configurations we want to test. You could also do things like 198 | # change flags or use --stack-yaml to point to a different file. 199 | env: 200 | - ARGS="" 201 | #- ARGS="--resolver lts-2" 202 | - ARGS="--resolver lts-3" 203 | - ARGS="--resolver lts" 204 | - ARGS="--resolver nightly" 205 | 206 | before_install: 207 | # Download and unpack the stack executable 208 | - mkdir -p ~/.local/bin 209 | - export PATH=$HOME/.local/bin:$PATH 210 | - travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' 211 | 212 | # This line does all of the work: installs GHC if necessary, build the library, 213 | # executables, and test suites, and runs the test suites. --no-terminal works 214 | # around some quirks in Travis's terminal implementation. 215 | script: stack $ARGS --no-terminal --install-ghc test --haddock 216 | 217 | # Caching so the next build will be fast too. 218 | cache: 219 | directories: 220 | - $HOME/.stack 221 | -------------------------------------------------------------------------------- /scotty-hspec-wai.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 9 | license: BSD-3-Clause 10 | license-file: LICENSE 11 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 12 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 13 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 14 | category: {{category}}{{^category}}Web{{/category}} 15 | build-type: Simple 16 | extra-source-files: README.md 17 | CHANGELOG.md 18 | 19 | library 20 | hs-source-dirs: src 21 | exposed-modules: Example 22 | build-depends: base >= 4.7 && < 5 23 | , aeson 24 | , scotty 25 | , wai 26 | default-language: Haskell2010 27 | ghc-options: -Wall 28 | -Wcompat 29 | -Widentities 30 | -Wincomplete-record-updates 31 | -Wincomplete-uni-patterns 32 | -Wmissing-export-lists 33 | -Wmissing-home-modules 34 | -Wpartial-fields 35 | -Wredundant-constraints 36 | 37 | executable {{name}}-exe 38 | hs-source-dirs: app 39 | main-is: Main.hs 40 | build-depends: base 41 | , {{name}} 42 | default-language: Haskell2010 43 | ghc-options: -Wall 44 | -Wcompat 45 | -Widentities 46 | -Wincomplete-record-updates 47 | -Wincomplete-uni-patterns 48 | -Wmissing-export-lists 49 | -Wmissing-home-modules 50 | -Wpartial-fields 51 | -Wredundant-constraints 52 | -O2 53 | -threaded 54 | -rtsopts 55 | -with-rtsopts=-N 56 | 57 | test-suite {{name}}-test 58 | type: exitcode-stdio-1.0 59 | hs-source-dirs: test 60 | main-is: Spec.hs 61 | build-depends: base 62 | , {{name}} 63 | , hspec 64 | , hspec-wai 65 | , hspec-wai-json 66 | , http-types 67 | , aeson 68 | default-language: Haskell2010 69 | ghc-options: -Wall 70 | -Wcompat 71 | -Widentities 72 | -Wincomplete-record-updates 73 | -Wincomplete-uni-patterns 74 | -Wmissing-export-lists 75 | -Wmissing-home-modules 76 | -Wpartial-fields 77 | -Wredundant-constraints 78 | -O2 79 | -threaded 80 | -rtsopts 81 | -with-rtsopts=-N 82 | 83 | source-repository head 84 | type: git 85 | location: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 86 | 87 | {-# START_FILE Setup.hs #-} 88 | import Distribution.Simple 89 | 90 | main = defaultMain 91 | 92 | {-# START_FILE test/Spec.hs #-} 93 | {-# LANGUAGE OverloadedStrings, QuasiQuotes #-} 94 | module Main (main) where 95 | 96 | import Test.Hspec 97 | import Test.Hspec.Wai 98 | import Test.Hspec.Wai.JSON 99 | import Network.HTTP.Types.Header 100 | 101 | import Example (app) 102 | 103 | main :: IO () 104 | main = hspec spec 105 | 106 | spec :: Spec 107 | spec = with app $ do 108 | describe "GET /" $ do 109 | it "responds with 200" $ do 110 | get "/" `shouldRespondWith` 200 111 | 112 | it "responds with 'hello'" $ do 113 | get "/" `shouldRespondWith` "hello" 114 | 115 | it "responds with 200 / 'hello'" $ do 116 | get "/" `shouldRespondWith` "hello" {matchStatus = 200} 117 | 118 | it "has 'Content-Type: text/plain; charset=utf-8'" $ do 119 | get "/" `shouldRespondWith` 200 {matchHeaders = ["Content-Type" <:> "text/plain; charset=utf-8"]} 120 | 121 | describe "GET /some-json" $ do 122 | it "responds with some JSON" $ do 123 | get "/some-json" `shouldRespondWith` expectedJsonResponse 124 | 125 | expectedJsonResponse :: ResponseMatcher 126 | expectedJsonResponse = 127 | let ResponseMatcher status _ body = [json|{foo: 23, bar: 42}|] 128 | in ResponseMatcher status [hContentType <:> "application/json; charset=utf-8"] body 129 | 130 | {-# START_FILE src/Example.hs #-} 131 | {-# LANGUAGE OverloadedStrings, QuasiQuotes #-} 132 | module Example (runApp, app) where 133 | 134 | import Data.Aeson (Value(..), object, (.=)) 135 | import Network.Wai (Application) 136 | import qualified Web.Scotty as S 137 | 138 | app' :: S.ScottyM () 139 | app' = do 140 | S.get "/" $ do 141 | S.text "hello" 142 | 143 | S.get "/some-json" $ do 144 | S.json $ object ["foo" .= Number 23, "bar" .= Number 42] 145 | 146 | app :: IO Application 147 | app = S.scottyApp app' 148 | 149 | runApp :: IO () 150 | runApp = S.scotty 8080 app' 151 | 152 | {-# START_FILE app/Main.hs #-} 153 | module Main (main) where 154 | 155 | import Example (runApp) 156 | 157 | main :: IO () 158 | main = runApp 159 | 160 | {-# START_FILE README.md #-} 161 | # {{name}} 162 | 163 | {-# START_FILE CHANGELOG.md #-} 164 | # Changelog for `{{ name }}` 165 | 166 | All notable changes to this project will be documented in this file. 167 | 168 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 169 | and this project adheres to the 170 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 171 | 172 | ## Unreleased 173 | 174 | ## 0.1.0.0 - YYYY-MM-DD 175 | 176 | {-# START_FILE LICENSE #-} 177 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 178 | 179 | Redistribution and use in source and binary forms, with or without 180 | modification, are permitted provided that the following conditions are met: 181 | 182 | 1. Redistributions of source code must retain the above copyright notice, this 183 | list of conditions and the following disclaimer. 184 | 185 | 2. Redistributions in binary form must reproduce the above copyright notice, 186 | this list of conditions and the following disclaimer in the documentation 187 | and/or other materials provided with the distribution. 188 | 189 | 3. Neither the name of the copyright holder nor the names of its contributors 190 | may be used to endorse or promote products derived from this software 191 | without specific prior written permission. 192 | 193 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 194 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 195 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 196 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 197 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 198 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 199 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 200 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 201 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 202 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 203 | 204 | {-# START_FILE .ghci #-} 205 | :set -XOverloadedStrings 206 | :set -XQuasiQuotes 207 | 208 | {-# START_FILE .gitignore #-} 209 | # GHC build artefacts 210 | *.hi 211 | *.o 212 | 213 | # Haskell Tool Stack-related 214 | .stack-work/ 215 | 216 | # Cabal-related 217 | dist* 218 | .cabal-sandbox 219 | cabal.sandbox.config 220 | 221 | # macOS-related 222 | .DS_Store 223 | 224 | # Vim-related 225 | *.swp 226 | 227 | # keter package-related: https://hackage.haskell.org/package/keter 228 | *.keter 229 | 230 | # hsenv package-related: https://hackage.haskell.org/package/hsenv 231 | .hsenv* 232 | -------------------------------------------------------------------------------- /hakyll-template.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: {{name}} 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme 9 | license: BSD-3-Clause 10 | license-file: LICENSE 11 | author: {{author-name}}{{^author-name}}Author name here{{/author-name}} 12 | maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}} 13 | copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}} 14 | category: {{category}}{{^category}}Web{{/category}} 15 | build-type: Simple 16 | extra-source-files: README.md 17 | CHANGELOG.md 18 | 19 | executable {{name}} 20 | main-is: site.hs 21 | default-language: Haskell2010 22 | build-depends: base >= 4.7 && < 5, 23 | hakyll 24 | ghc-options: -Wall 25 | -Wcompat 26 | -Widentities 27 | -Wincomplete-record-updates 28 | -Wincomplete-uni-patterns 29 | -Wmissing-export-lists 30 | -Wmissing-home-modules 31 | -Wpartial-fields 32 | -Wredundant-constraints 33 | -threaded 34 | 35 | {-# START_FILE .ghci #-} 36 | :set -XOverloadedStrings 37 | import Hakyll 38 | 39 | {-# START_FILE site.hs #-} 40 | -------------------------------------------------------------------------------- 41 | {-# LANGUAGE OverloadedStrings #-} 42 | import Data.Monoid (mappend) 43 | import Hakyll 44 | 45 | 46 | -------------------------------------------------------------------------------- 47 | main :: IO () 48 | main = hakyll $ do 49 | match "images/*" $ do 50 | route idRoute 51 | compile copyFileCompiler 52 | 53 | match "css/*" $ do 54 | route idRoute 55 | compile compressCssCompiler 56 | 57 | match (fromList ["about.rst", "contact.markdown"]) $ do 58 | route $ setExtension "html" 59 | compile $ pandocCompiler 60 | >>= loadAndApplyTemplate "templates/default.html" defaultContext 61 | >>= relativizeUrls 62 | 63 | match "posts/*" $ do 64 | route $ setExtension "html" 65 | compile $ pandocCompiler 66 | >>= loadAndApplyTemplate "templates/post.html" postCtx 67 | >>= loadAndApplyTemplate "templates/default.html" postCtx 68 | >>= relativizeUrls 69 | 70 | create ["archive.html"] $ do 71 | route idRoute 72 | compile $ do 73 | posts <- recentFirst =<< loadAll "posts/*" 74 | let archiveCtx = 75 | listField "posts" postCtx (return posts) `mappend` 76 | constField "title" "Archives" `mappend` 77 | defaultContext 78 | 79 | makeItem "" 80 | >>= loadAndApplyTemplate "templates/archive.html" archiveCtx 81 | >>= loadAndApplyTemplate "templates/default.html" archiveCtx 82 | >>= relativizeUrls 83 | 84 | 85 | match "index.html" $ do 86 | route idRoute 87 | compile $ do 88 | posts <- recentFirst =<< loadAll "posts/*" 89 | let indexCtx = 90 | listField "posts" postCtx (return posts) `mappend` 91 | constField "title" "Home" `mappend` 92 | defaultContext 93 | 94 | getResourceBody 95 | >>= applyAsTemplate indexCtx 96 | >>= loadAndApplyTemplate "templates/default.html" indexCtx 97 | >>= relativizeUrls 98 | 99 | match "templates/*" $ compile templateCompiler 100 | 101 | 102 | -------------------------------------------------------------------------------- 103 | postCtx :: Context String 104 | postCtx = 105 | dateField "date" "%B %e, %Y" `mappend` 106 | defaultContext 107 | 108 | 109 | {-# START_FILE index.html #-} 110 | --- 111 | title: Home 112 | --- 113 | 114 |

Welcome

115 | 116 |

Welcome to my blog!

117 | 118 |

I've reproduced a list of recent posts here for your reading pleasure:

119 | 120 |

Posts

121 | $partial("templates/post-list.html")$ 122 | 123 |

…or you can find more in the archives.

124 | 125 | {-# START_FILE templates/archive.html #-} 126 | Here you can find all my previous posts: 127 | $partial("templates/post-list.html")$ 128 | 129 | {-# START_FILE templates/default.html #-} 130 | 131 | 133 | 134 | 135 | 136 | My Hakyll Blog - $title$ 137 | 138 | 139 | 140 | 151 | 152 |
153 |

$title$

154 | 155 | $body$ 156 |
157 | 161 | 162 | 163 | 164 | {-# START_FILE templates/post.html #-} 165 |
166 | Posted on $date$ 167 | $if(author)$ 168 | by $author$ 169 | $endif$ 170 |
171 | 172 | $body$ 173 | 174 | {-# START_FILE templates/post-list.html #-} 175 |
    176 | $for(posts)$ 177 |
  • 178 | $title$ - $date$ 179 |
  • 180 | $endfor$ 181 |
182 | 183 | {-# START_FILE contact.markdown #-} 184 | --- 185 | title: Contact 186 | --- 187 | 188 | I live in a small hut in the mountains of Kumano Kodō on Kii Hantō and would not 189 | like to be contacted. 190 | 191 | {-# START_FILE posts/2015-08-23-example.markdown #-} 192 | --- 193 | title: example post 194 | --- 195 | 196 | Mauris in lorem nisl. Maecenas tempus facilisis ante, eget viverra nisl 197 | tincidunt et. Donec turpis lectus, mattis ac malesuada a, accumsan eu libero. 198 | Morbi condimentum, tortor et tincidunt ullamcorper, sem quam pretium nulla, id 199 | convallis lectus libero nec turpis. Proin dapibus nisi id est sodales nec 200 | ultrices tortor pellentesque. 201 | 202 | Vivamus vel nisi ac lacus sollicitudin vulputate 203 | ac ut ligula. Nullam feugiat risus eget eros gravida in molestie sapien euismod. 204 | Nunc sed hendrerit orci. Nulla mollis consequat lorem ac blandit. Ut et turpis 205 | mauris. Nulla est odio, posuere id ullamcorper sit amet, tincidunt vel justo. 206 | Curabitur placerat tincidunt varius. Nulla vulputate, ipsum eu consectetur 207 | mollis, dui nibh aliquam neque, at ultricies leo ligula et arcu. 208 | 209 | {-# START_FILE about.rst #-} 210 | --- 211 | title: About 212 | --- 213 | Nullam imperdiet sodales orci vitae molestie. Nunc quam orci, pharetra a 214 | rhoncus vitae, eleifend id felis. Suspendisse potenti. Etiam vitae urna orci. 215 | Quisque pellentesque dignissim felis, egestas tempus urna luctus vitae. In hac 216 | habitasse platea dictumst. Morbi fringilla mattis odio, et mattis tellus 217 | accumsan vitae. 218 | 219 | 1. Amamus Unicode 碁 220 | 2. Interdum nex magna. 221 | 222 | Vivamus eget mauris sit amet nulla laoreet lobortis. Nulla in diam elementum 223 | risus convallis commodo. Cras vehicula varius dui vitae facilisis. Proin 224 | elementum libero eget leo aliquet quis euismod orci vestibulum. Duis rhoncus 225 | lorem consequat tellus vestibulum aliquam. Quisque orci orci, malesuada porta 226 | blandit et, interdum nec magna. 227 | 228 | {-# START_FILE css/default.css #-} 229 | body { 230 | color: black; 231 | font-size: 16px; 232 | margin: 0px auto 0px auto; 233 | width: 600px; 234 | } 235 | 236 | div#header { 237 | border-bottom: 2px solid black; 238 | margin-bottom: 30px; 239 | padding: 12px 0px 12px 0px; 240 | } 241 | 242 | div#logo a { 243 | color: black; 244 | float: left; 245 | font-size: 18px; 246 | font-weight: bold; 247 | text-decoration: none; 248 | } 249 | 250 | div#header #navigation { 251 | text-align: right; 252 | } 253 | 254 | div#header #navigation a { 255 | color: black; 256 | font-size: 18px; 257 | font-weight: bold; 258 | margin-left: 12px; 259 | text-decoration: none; 260 | text-transform: uppercase; 261 | } 262 | 263 | div#footer { 264 | border-top: solid 2px black; 265 | color: #555; 266 | font-size: 12px; 267 | margin-top: 30px; 268 | padding: 12px 0px 12px 0px; 269 | text-align: right; 270 | } 271 | 272 | h1 { 273 | font-size: 24px; 274 | } 275 | 276 | h2 { 277 | font-size: 20px; 278 | } 279 | 280 | div.info { 281 | color: #555; 282 | font-size: 14px; 283 | font-style: italic; 284 | } 285 | 286 | {-# START_FILE README.md #-} 287 | # {{name}} 288 | 289 | {-# START_FILE CHANGELOG.md #-} 290 | # Changelog for `{{ name }}` 291 | 292 | All notable changes to this project will be documented in this file. 293 | 294 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 295 | and this project adheres to the 296 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 297 | 298 | ## Unreleased 299 | 300 | ## 0.1.0.0 - YYYY-MM-DD 301 | 302 | {-# START_FILE LICENSE #-} 303 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 304 | 305 | Redistribution and use in source and binary forms, with or without 306 | modification, are permitted provided that the following conditions are met: 307 | 308 | 1. Redistributions of source code must retain the above copyright notice, this 309 | list of conditions and the following disclaimer. 310 | 311 | 2. Redistributions in binary form must reproduce the above copyright notice, 312 | this list of conditions and the following disclaimer in the documentation 313 | and/or other materials provided with the distribution. 314 | 315 | 3. Neither the name of the copyright holder nor the names of its contributors 316 | may be used to endorse or promote products derived from this software 317 | without specific prior written permission. 318 | 319 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 320 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 321 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 322 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 323 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 324 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 325 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 326 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 327 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 328 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 329 | 330 | {-# START_FILE .gitignore #-} 331 | # Created by https://www.gitignore.io/api/haskell 332 | 333 | ### Haskell ### 334 | dist 335 | cabal-dev 336 | *.o 337 | *.hi 338 | *.chi 339 | *.chs.h 340 | *.dyn_o 341 | *.dyn_hi 342 | .hpc 343 | .hsenv 344 | .cabal-sandbox/ 345 | cabal.sandbox.config 346 | *.prof 347 | *.aux 348 | *.hp 349 | .stack-work/ 350 | _cache/ 351 | _site/ 352 | -------------------------------------------------------------------------------- /tasty-travis.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | name: {{name}} 3 | version: 0.1.0.0 4 | -- synopsis: 5 | -- description: 6 | 7 | license: ISC 8 | license-file: LICENSE 9 | author: {{author-name}}{{^author-name}}TODO:{{/author-name}} 10 | maintainer: {{author-email}}{{^author-email}}TODO:{{/author-email}} 11 | copyright: © {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}TODO:{{/author-name}} 12 | homepage: https://github.com/{{github-username}}{{^github-username}}TODO:{{/github-username}}/{{name}} 13 | bug-reports: https://github.com/{{github-username}}{{^github-username}}TODO:{{/github-username}}/{{name}}/issues 14 | 15 | category: Test 16 | build-type: Simple 17 | stability: alpha (experimental) 18 | cabal-version: >=1.10 19 | 20 | extra-source-files: 21 | README.md 22 | CHANGELOG.md 23 | stack.yaml 24 | 25 | source-repository head 26 | type: git 27 | location: https://github.com/{{github-username}}{{^github-username}}TODO:{{/github-username}}/{{name}} 28 | 29 | library 30 | default-language: Haskell2010 31 | hs-source-dirs: src 32 | exposed-modules: Lib 33 | build-depends: base >= 4.8 && < 5 34 | ghc-options: -Wall 35 | -Werror 36 | -Wcompat 37 | -Widentities 38 | -Wincomplete-record-updates 39 | -Wincomplete-uni-patterns 40 | -Wmissing-export-lists 41 | -Wmissing-home-modules 42 | -Wpartial-fields 43 | -Wredundant-constraints 44 | -O2 45 | 46 | executable {{name}}-exe 47 | default-language: Haskell2010 48 | hs-source-dirs: src-exe 49 | main-is: Main.hs 50 | build-depends: base >= 4.8 && < 5 51 | , {{name}} 52 | ghc-options: -Wall 53 | -Werror 54 | -Wcompat 55 | -Widentities 56 | -Wincomplete-record-updates 57 | -Wincomplete-uni-patterns 58 | -Wmissing-export-lists 59 | -Wmissing-home-modules 60 | -Wpartial-fields 61 | -Wredundant-constraints 62 | -O2 63 | -threaded 64 | -rtsopts 65 | -with-rtsopts=-N 66 | 67 | test-suite {{name}}-test 68 | type: exitcode-stdio-1.0 69 | default-language: Haskell2010 70 | hs-source-dirs: src-test 71 | main-is: Main.hs 72 | build-depends: base >= 4.8 && < 5 73 | , tasty >= 0.11 74 | , tasty-hunit >= 0.9 75 | , tasty-smallcheck >= 0.8 76 | , {{name}} 77 | ghc-options: -Wall 78 | -Werror 79 | -Wcompat 80 | -Widentities 81 | -Wincomplete-record-updates 82 | -Wincomplete-uni-patterns 83 | -Wmissing-export-lists 84 | -Wmissing-home-modules 85 | -Wpartial-fields 86 | -Wredundant-constraints 87 | -O2 88 | -threaded 89 | -rtsopts 90 | -with-rtsopts=-N 91 | 92 | test-suite {{name}}-doctest 93 | type: exitcode-stdio-1.0 94 | default-language: Haskell2010 95 | hs-source-dirs: src-doctest 96 | main-is: Main.hs 97 | build-depends: base >= 4.8 && < 5 98 | , doctest >=0.10 99 | , Glob >= 0.7 100 | , QuickCheck >= 2.5 101 | , {{name}} 102 | ghc-options: -Wall 103 | -Werror 104 | -Wcompat 105 | -Widentities 106 | -Wincomplete-record-updates 107 | -Wincomplete-uni-patterns 108 | -Wmissing-export-lists 109 | -Wmissing-home-modules 110 | -Wpartial-fields 111 | -Wredundant-constraints 112 | -O2 113 | -threaded 114 | -rtsopts 115 | -with-rtsopts=-N 116 | 117 | benchmark {{name}}-benchmark 118 | type: exitcode-stdio-1.0 119 | default-language: Haskell2010 120 | hs-source-dirs: src-benchmark 121 | main-is: Main.hs 122 | build-depends: base >= 4.8 && < 5 123 | , criterion >= 1.1 124 | , {{name}} 125 | ghc-options: -Wall 126 | -Werror 127 | -Wcompat 128 | -Widentities 129 | -Wincomplete-record-updates 130 | -Wincomplete-uni-patterns 131 | -Wmissing-export-lists 132 | -Wmissing-home-modules 133 | -Wpartial-fields 134 | -Wredundant-constraints 135 | -O2 136 | -threaded 137 | -rtsopts 138 | -with-rtsopts=-N 139 | 140 | {-# START_FILE Setup.hs #-} 141 | import Distribution.Simple 142 | main = defaultMain 143 | 144 | {-# START_FILE src/Lib.hs #-} 145 | -- | Example of a library file. It is also used for testing the test suites. 146 | module Lib 147 | ( 148 | -- * Exported functions 149 | inc 150 | ) where 151 | 152 | -- | Increment one 'Num' value. 153 | -- 154 | -- >>> let answer = 42 :: Int 155 | -- >>> let prev = answer - 1 156 | -- >>> inc prev 157 | -- 42 158 | -- >>> succ . Prelude.last . Prelude.take prev . iterate inc $ 1 159 | -- 42 160 | -- 161 | -- Properties: 162 | -- 163 | -- prop> succ x == inc x 164 | -- prop> inc (negate x) == negate (pred x) 165 | -- 166 | inc :: Num a => a -- ^ value to increment 167 | -> a -- ^ result 168 | inc x = x + 1 169 | 170 | {-# START_FILE src-exe/Main.hs #-} 171 | import Lib (inc) 172 | 173 | main :: IO () 174 | main = print . inc $ (41 :: Int) 175 | 176 | {-# START_FILE src-test/Main.hs #-} 177 | import Test.Tasty 178 | import Test.Tasty.HUnit 179 | import Test.Tasty.SmallCheck 180 | 181 | import Lib (inc) 182 | 183 | main :: IO () 184 | main = defaultMain $ testGroup "all-tests" tests 185 | 186 | tests :: [TestTree] 187 | tests = 188 | [ testGroup "SmallCheck" scTests 189 | , testGroup "Unit tests" huTests 190 | ] 191 | 192 | scTests :: [TestTree] 193 | scTests = 194 | [ testProperty "inc == succ" prop_succ 195 | , testProperty "inc . negate == negate . pred" prop_pred 196 | ] 197 | 198 | huTests :: [TestTree] 199 | huTests = 200 | [ testCase "Increment below TheAnswer" case_inc_below 201 | , testCase "Decrement above TheAnswer" case_dec_above 202 | ] 203 | 204 | prop_succ :: Int -> Bool 205 | prop_succ n = inc n == succ n 206 | 207 | prop_pred :: Int -> Bool 208 | prop_pred n = inc (negate n) == negate (pred n) 209 | 210 | case_inc_below :: Assertion 211 | case_inc_below = inc 41 @?= (42 :: Int) 212 | 213 | case_dec_above :: Assertion 214 | case_dec_above = negate (inc (negate 43)) @?= (42 :: Int) 215 | 216 | {-# START_FILE src-doctest/Main.hs #-} 217 | import System.FilePath.Glob 218 | import Test.DocTest 219 | 220 | main :: IO () 221 | main = glob "src/**/*.hs" >>= doctest 222 | 223 | {-# START_FILE src-benchmark/Main.hs #-} 224 | import Criterion 225 | import Criterion.Main 226 | 227 | import Lib (inc) 228 | 229 | main :: IO () 230 | main = defaultMain [bench "inc 41" (whnf inc (41 :: Int))] 231 | 232 | {-# START_FILE README.md #-} 233 | {{name}} 234 | ========== 235 | 236 | New Haskell project using stack template `tasty-travis`. 237 | 238 | Please read file `tutorial.md` for first steps in using the template. 239 | 240 | {-# START_FILE CHANGELOG.md #-} 241 | Change log 242 | ========== 243 | 244 | {{name}} uses [Semantic Versioning][1]. 245 | The change log is available [on GitHub][2]. 246 | 247 | [1]: http://semver.org/spec/v2.0.0.html 248 | [2]: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}/releases 249 | 250 | ## v0.1.0.0 251 | 252 | * Initially created. 253 | 254 | {-# START_FILE LICENSE #-} 255 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}TODO:{{/author-name}} 256 | 257 | Permission to use, copy, modify, and/or distribute this software for any purpose 258 | with or without fee is hereby granted, provided that the above copyright notice 259 | and this permission notice appear in all copies. 260 | 261 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 262 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 263 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 264 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 265 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 266 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 267 | THIS SOFTWARE. 268 | 269 | {-# START_FILE .gitignore #-} 270 | /tutorial.md 271 | /.stack-work/ 272 | 273 | {-# START_FILE .travis.yml #-} 274 | # Use new container infrastructure to enable caching 275 | sudo: false 276 | 277 | # Choose a lightweight base image; we provide our own build tools. 278 | language: c 279 | 280 | # GHC depends on GMP. You can add other dependencies here as well. 281 | addons: 282 | apt: 283 | packages: 284 | - libgmp-dev 285 | 286 | # The different configurations we want to test. You could also do things like 287 | # change flags or use --stack-yaml to point to a different file. 288 | env: 289 | - ARGS="" 290 | #- ARGS="--resolver lts-2" 291 | - ARGS="--resolver lts" 292 | - ARGS="--resolver nightly" 293 | 294 | before_install: 295 | # Download and unpack the stack executable 296 | - mkdir -p ~/.local/bin 297 | - export PATH=$HOME/.local/bin:$PATH 298 | - travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' 299 | 300 | # This line does all of the work: installs GHC if necessary, builds the 301 | # library, executables, and test suites, and runs the test suites. 302 | # `--no-terminal works` around some quirks in Travis's terminal implementation. 303 | script: stack $ARGS --no-terminal --install-ghc test 304 | 305 | # Caching so the next build will be fast too. 306 | cache: 307 | directories: 308 | - $HOME/.stack 309 | 310 | {-# START_FILE tutorial.md #-} 311 | 312 | Thanks for using the stack template `tasty-travis`! This file is here to guide 313 | you through customizing the template files. 314 | 315 | This template allows you to start a simple Haskell project, either to create a 316 | library or an application. It offers you the choice to customize the source 317 | directory while providing hints on the proposed hierarchy that the author uses 318 | (inspired by other Haskell projects). 319 | 320 | In the following sections, I will explain how to use the template. 321 | 322 | 1. Initial configurations 323 | ========================= 324 | 325 | Before you get started, there are a few things that this template couldn't 326 | provide for you. You should: 327 | 328 | * Add a synopsis to `{{name}}.cabal`. It should be a short, one sentence 329 | explanation of your project. 330 | 331 | * Edit the description field in `{{name}}.cabal` if you don't like having 332 | the description in the `README.md` file. 333 | 334 | * In `{{name}}.cabal`, the category of the project has been set as 'Test'. 335 | You might wish to change it to a more descriptive value. A list of 336 | categories that you can use for the project is available on Hackage at 337 | . Alternatively, you might prefer using 338 | a name from the shorter list at 339 | . 340 | 341 | * If you haven't provided the `author-email`, `author-name`, and 342 | `github-username` to the `config.yaml` global file, you will have to search 343 | for "TODO" markup and complete this information in `{{name}}.cabal` and/or 344 | in `LICENSE`. 345 | 346 | 2. Creating the git repository 347 | ============================== 348 | 349 | If this project is a subdirectory of a larger project with an existing version 350 | control or you want to use another version control system or another setup, 351 | then you can ignore this section. 352 | 353 | From the root directory of the project (the directory of this file) you will 354 | need to run the following three commands: 355 | 356 | git init 357 | git add . 358 | git commit -m "Initial commit" 359 | 360 | Now you can create a repository on GitHub to publish the code. 361 | 362 | Note that this file is excluded from the repository by being included in the 363 | `.gitignore` file. If you want this file to be tracked, you can remove the 364 | line `/tutorial.md` from that file. 365 | 366 | 3. Testing the initial code 367 | =========================== 368 | 369 | These are the stack commands you will likely use the most: 370 | 371 | ``` sh 372 | # Build the project. 373 | stack build 374 | 375 | # Run the binary 376 | stack exec {{name}}-exe 377 | 378 | # Run the test suite. 379 | stack test 380 | 381 | # Run the benchmarks. 382 | stack bench 383 | 384 | # Generate documentation. 385 | stack haddock 386 | ``` 387 | 388 | 4. Customizing 389 | ============== 390 | 391 | As you see, the template creates both a library and a binary and tests the 392 | library using two test suites (doctests from comments and tests with Tasty). 393 | Both test suites can test both properties and expected testcases. Finally, 394 | the template also offers a way to benchmark the code. 395 | 396 | Your project might differ significantly from this template. For example, you 397 | might want to have a different number of executables. In that case, you should 398 | remove/add more executable stanzas in `{{name}}.cabal`. 399 | 400 | Similarly, if you don't want both test suites, you can remove one of the 401 | stanzas. You could do the same for the benchmarks. 402 | 403 | *More importantly* you might want to change the contents of the library. 404 | Rename `src/Lib` to whatever you want your top-module to be, usually the name 405 | of your project but using `CamelCase`. Don't forget to change this name in all 406 | places where it is referenced (executable(s), test(s) and benchmark(s)). 407 | 408 | Thanks again, and happy hacking! 409 | -------------------------------------------------------------------------------- /readme-lhs.hsfiles: -------------------------------------------------------------------------------- 1 | {-# START_FILE {{name}}.cabal #-} 2 | cabal-version: 2.2 3 | 4 | name: 5 | {{name}} 6 | version: 7 | 0.0.1 8 | synopsis: 9 | See README.md 10 | description: 11 | See README.md for description. 12 | category: 13 | project 14 | homepage: 15 | https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 16 | license: 17 | BSD-3-Clause 18 | license-file: 19 | LICENSE 20 | author: 21 | {{author-name}}{{^author-name}}Author name here{{/author-name}} 22 | maintainer: 23 | {{author-email}}{{^author-email}}example@example.com{{/author-email}} 24 | copyright: 25 | {{copyright}}{{^copyright}}{{year}}{{^year}}2024{{/year}} {{authorName}}{{^authorName}}Author name here{{/authorName}}{{/copyright}} 26 | build-type: 27 | Simple 28 | extra-source-files: 29 | README.md 30 | CHANGELOG.md 31 | stack.yaml 32 | other/lhs.css 33 | other/header.md 34 | library 35 | default-language: 36 | Haskell2010 37 | ghc-options: 38 | -Wall 39 | -Wcompat 40 | -Widentities 41 | -Wincomplete-record-updates 42 | -Wincomplete-uni-patterns 43 | -Wmissing-export-lists 44 | -Wmissing-home-modules 45 | -Wpartial-fields 46 | -Wredundant-constraints 47 | 48 | hs-source-dirs: 49 | 50 | exposed-modules: 51 | 52 | build-depends: 53 | base >= 4.7 && < 5 54 | default-extensions: 55 | NoImplicitPrelude, 56 | UnicodeSyntax, 57 | BangPatterns, 58 | BinaryLiterals, 59 | DeriveFoldable, 60 | DeriveFunctor, 61 | DeriveGeneric, 62 | DeriveTraversable, 63 | DisambiguateRecordFields, 64 | EmptyCase, 65 | FlexibleContexts, 66 | FlexibleInstances, 67 | FunctionalDependencies, 68 | GADTSyntax, 69 | InstanceSigs, 70 | KindSignatures, 71 | LambdaCase, 72 | MonadComprehensions, 73 | MultiParamTypeClasses, 74 | MultiWayIf, 75 | NegativeLiterals, 76 | OverloadedStrings, 77 | ParallelListComp, 78 | PartialTypeSignatures, 79 | PatternSynonyms, 80 | RankNTypes, 81 | RecordWildCards, 82 | RecursiveDo, 83 | ScopedTypeVariables, 84 | TupleSections, 85 | TypeFamilies, 86 | TypeOperators 87 | 88 | executable {{name}}-example 89 | default-language: 90 | Haskell2010 91 | ghc-options: 92 | -Wall 93 | -Wcompat 94 | -Widentities 95 | -Wincomplete-record-updates 96 | -Wincomplete-uni-patterns 97 | -Wmissing-export-lists 98 | -Wmissing-home-modules 99 | -Wpartial-fields 100 | -Wredundant-constraints 101 | -funbox-strict-fields 102 | -fforce-recomp 103 | -threaded 104 | -rtsopts 105 | -with-rtsopts=-N 106 | hs-source-dirs: 107 | app 108 | main-is: 109 | example.lhs 110 | build-depends: 111 | base >= 4.7 && < 5, 112 | protolude, 113 | optparse-generic 114 | default-extensions: 115 | NoImplicitPrelude, 116 | UnicodeSyntax, 117 | BangPatterns, 118 | BinaryLiterals, 119 | DeriveFoldable, 120 | DeriveFunctor, 121 | DeriveGeneric, 122 | DeriveTraversable, 123 | DisambiguateRecordFields, 124 | EmptyCase, 125 | FlexibleContexts, 126 | FlexibleInstances, 127 | FunctionalDependencies, 128 | GADTSyntax, 129 | InstanceSigs, 130 | KindSignatures, 131 | LambdaCase, 132 | MonadComprehensions, 133 | MultiParamTypeClasses, 134 | MultiWayIf, 135 | NegativeLiterals, 136 | OverloadedStrings, 137 | ParallelListComp, 138 | PartialTypeSignatures, 139 | PatternSynonyms, 140 | RankNTypes, 141 | RecordWildCards, 142 | RecursiveDo, 143 | ScopedTypeVariables, 144 | TupleSections, 145 | TypeFamilies, 146 | TypeOperators 147 | 148 | test-suite test 149 | default-language: 150 | Haskell2010 151 | type: 152 | exitcode-stdio-1.0 153 | hs-source-dirs: 154 | test 155 | main-is: 156 | test.hs 157 | build-depends: 158 | base >= 4.7 && < 5, 159 | tasty, 160 | HUnit, 161 | tasty-hunit, 162 | QuickCheck, 163 | tasty-quickcheck, 164 | doctest, 165 | protolude 166 | default-extensions: 167 | NoImplicitPrelude, 168 | UnicodeSyntax, 169 | BangPatterns, 170 | BinaryLiterals, 171 | DeriveFoldable, 172 | DeriveFunctor, 173 | DeriveGeneric, 174 | DeriveTraversable, 175 | DisambiguateRecordFields, 176 | EmptyCase, 177 | FlexibleContexts, 178 | FlexibleInstances, 179 | FunctionalDependencies, 180 | GADTSyntax, 181 | InstanceSigs, 182 | KindSignatures, 183 | LambdaCase, 184 | MonadComprehensions, 185 | MultiParamTypeClasses, 186 | MultiWayIf, 187 | NegativeLiterals, 188 | OverloadedStrings, 189 | ParallelListComp, 190 | PartialTypeSignatures, 191 | PatternSynonyms, 192 | RankNTypes, 193 | RecordWildCards, 194 | RecursiveDo, 195 | ScopedTypeVariables, 196 | TupleSections, 197 | TypeFamilies, 198 | TypeOperators 199 | ghc-options: 200 | -Wall 201 | -Wcompat 202 | -Widentities 203 | -Wincomplete-record-updates 204 | -Wincomplete-uni-patterns 205 | -Wmissing-export-lists 206 | -Wmissing-home-modules 207 | -Wpartial-fields 208 | -Wredundant-constraints 209 | 210 | source-repository head 211 | type: 212 | git 213 | location: 214 | https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}} 215 | 216 | {-# START_FILE Setup.hs #-} 217 | import Distribution.Simple 218 | main = defaultMain 219 | 220 | {-# START_FILE app/example.lhs #-} 221 | ```include 222 | other/header.md 223 | ``` 224 | 225 | {{name}} 226 | === 227 | 228 | [ghc options](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/flags.html#flag-reference) 229 | --- 230 | 231 | \begin{code} 232 | {-# OPTIONS_GHC -Wall #-} 233 | {-# OPTIONS_GHC -fno-warn-type-defaults #-} 234 | \end{code} 235 | 236 | [pragmas](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/lang.html) 237 | --- 238 | 239 | \begin{code} 240 | -- doctest doesn't look at the cabal file, so you need pragmas here 241 | {-# LANGUAGE NoImplicitPrelude #-} 242 | {-# LANGUAGE OverloadedStrings #-} 243 | {-# LANGUAGE DataKinds #-} 244 | {-# LANGUAGE DeriveGeneric #-} 245 | {-# LANGUAGE ScopedTypeVariables #-} 246 | {-# LANGUAGE TypeOperators #-} 247 | {-# LANGUAGE FlexibleInstances #-} 248 | \end{code} 249 | 250 | [libraries](https://www.stackage.org/) 251 | --- 252 | 253 | - [protolude](https://www.stackage.org/package/protolude) 254 | - [optparse-generic](https://www.stackage.org/package/optparse-generic) 255 | 256 | \begin{code} 257 | import Protolude 258 | import Options.Generic 259 | \end{code} 260 | 261 | code 262 | --- 263 | 264 | - [hoogle](https://www.stackage.org/package/hoogle) 265 | 266 | \begin{code} 267 | data Opts w = Opts 268 | { number :: w ::: Maybe Integer "The number you want to product to" 269 | } 270 | deriving (Generic) 271 | 272 | instance ParseRecord (Opts Wrapped) 273 | 274 | main :: IO () 275 | main = do 276 | o :: Opts Unwrapped <- unwrapRecord "an example app for readme-lhs" 277 | let n = fromMaybe 10 (number o) 278 | let answer = product [1..n] 279 | putStrLn (show answer <> " 👍" :: Text) 280 | writeFile "other/answer.md" 281 | ("$\\prod_{i=1}^{" <> show n <> "} i = " <> 282 | show answer <> "$") 283 | \end{code} 284 | 285 | output 286 | --- 287 | 288 | ```include 289 | other/answer.md 290 | ``` 291 | 292 | tests 293 | --- 294 | 295 | - [doctest](https://www.stackage.org/package/doctest) 296 | 297 | \begin{code} 298 | -- | doctests 299 | -- >>> let n = 10 300 | -- >>> product [1..n] 301 | -- 3628800 302 | \end{code} 303 | 304 | *** 305 | 306 | 309 | 310 | {-# START_FILE test/test.hs #-} 311 | {-# OPTIONS_GHC -Wall #-} 312 | 313 | module Main (main) where 314 | 315 | import Protolude 316 | import Test.Tasty (TestTree, testGroup, defaultMain) 317 | import Test.DocTest 318 | 319 | main :: IO () 320 | main = do 321 | doctest ["app/example.lhs"] 322 | defaultMain tests 323 | 324 | tests :: TestTree 325 | tests = 326 | testGroup "" 327 | [ 328 | ] 329 | 330 | {-# START_FILE README.md #-} 331 | {{name}} 332 | === 333 | 334 | [![Build Status](https://travis-ci.org/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}.png)](https://travis-ci.org/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}) 335 | 336 | See https://{{github-username}}{{^github-username}}githubuser{{/github-username}}.github.io/{{name}}/index.html for project description. 337 | 338 | ~~~ 339 | stack build --test --exec "$(stack path --local-install-root)/bin/{{name}}-example" --exec "$(stack path --local-bin)/pandoc -f markdown+lhs -i app/example.lhs -t html -o index.html --filter pandoc-include --mathjax" --file-watch 340 | ~~~ 341 | 342 | {-# START_FILE CHANGELOG.md #-} 343 | # Changelog for `{{ name }}` 344 | 345 | All notable changes to this project will be documented in this file. 346 | 347 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 348 | and this project adheres to the 349 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 350 | 351 | ## Unreleased 352 | 353 | ## 0.0.1 - YYYY-MM-DD 354 | 355 | {-# START_FILE LICENSE #-} 356 | Copyright {{year}}{{^year}}2024{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}} 357 | 358 | Redistribution and use in source and binary forms, with or without 359 | modification, are permitted provided that the following conditions are met: 360 | 361 | 1. Redistributions of source code must retain the above copyright notice, this 362 | list of conditions and the following disclaimer. 363 | 364 | 2. Redistributions in binary form must reproduce the above copyright notice, 365 | this list of conditions and the following disclaimer in the documentation 366 | and/or other materials provided with the distribution. 367 | 368 | 3. Neither the name of the copyright holder nor the names of its contributors 369 | may be used to endorse or promote products derived from this software 370 | without specific prior written permission. 371 | 372 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 373 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 374 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 375 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 376 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 377 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 378 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 379 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 380 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 381 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 382 | 383 | {-# START_FILE .gitignore #-} 384 | /.stack-work/ 385 | TAGS 386 | 387 | {-# START_FILE .gitattributes #-} 388 | other/* linguist-documentation 389 | index.html linguist-documentation 390 | 391 | {-# START_FILE .travis.yml #-} 392 | # This is the simple Travis configuration, which is intended for use 393 | # on applications which do not require cross-platform and 394 | # multiple-GHC-version support. For more information and other 395 | # options, see: 396 | # 397 | # https://docs.haskellstack.org/en/stable/travis_ci/ 398 | # 399 | # Copy these contents into the root directory of your Github project in a file 400 | # named .travis.yml 401 | 402 | # Use new container infrastructure to enable caching 403 | sudo: false 404 | 405 | # Do not choose a language; we provide our own build tools. 406 | language: generic 407 | 408 | # Caching so the next build will be fast too. 409 | cache: 410 | directories: 411 | - $HOME/.stack 412 | 413 | # Ensure necessary system libraries are present 414 | addons: 415 | apt: 416 | packages: 417 | - libgmp-dev 418 | 419 | before_install: 420 | # Download and unpack the stack executable 421 | - mkdir -p ~/.local/bin 422 | - export PATH=$HOME/.local/bin:$PATH 423 | - travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' 424 | 425 | install: 426 | # Build dependencies 427 | - stack --no-terminal --install-ghc test --only-dependencies 428 | 429 | script: 430 | # Build the package, its tests, and its docs and run the tests 431 | - stack --no-terminal test --haddock --no-haddock-deps 432 | 433 | {-# START_FILE other/lhs.css #-} 434 | h1 { 435 | font-family: "Rockwell", "Futura", "Century Gothic", "Helvetica Neue", Helvetica, Arial, sans-serif; 436 | font-size: 32px; 437 | margin: 16px 0 32px 0; 438 | line-height: 1.1; 439 | } 440 | 441 | h2 { 442 | font-family: "Rockwell", "Futura", "Century Gothic", "Helvetica Neue", Helvetica, Arial, sans-serif; 443 | font-size: 24px; 444 | margin: 40px 0 20px 0; 445 | line-height: 1.1; 446 | } 447 | 448 | body { 449 | background-color: #f6f6f6; 450 | color: #3d3d3d; 451 | font-family: "Futura", "Century Gothic", "Helvetica Neue", Helvetica, Arial, sans-serif; 452 | font-size: 16px; 453 | line-height: 1.6; 454 | word-wrap: break-word; 455 | min-width: 200px; 456 | max-width: 900px; 457 | margin: 0 auto; 458 | padding: 45px; 459 | } 460 | 461 | body a { 462 | background-color: transparent; 463 | border-bottom: 2px solid #e1e1e1; 464 | color: #3d3d3d; 465 | text-decoration: none; 466 | } 467 | 468 | body a:hover { 469 | color: #2640cb; 470 | border-color: #2640cb; 471 | text-decoration: none; 472 | } 473 | 474 | body blockquote { 475 | border-left: 0.25rem solid #ebebeb; 476 | border-left-style: solid; 477 | font-style: italic; 478 | margin: 0.5rem 0 1rem 0; 479 | padding: 0 0 0 1rem; 480 | padding: 0 15px; 481 | color: #777; 482 | } 483 | 484 | body code { 485 | color: #49341c; 486 | background-color: #f5f0f0; 487 | } 488 | 489 | body .footer { 490 | color: #888888; 491 | font-size: 10px; 492 | text-align: right; 493 | } 494 | 495 | body hr { 496 | height: 0; 497 | margin: 15px 0; 498 | overflow: hidden; 499 | background: transparent; 500 | border: 0; 501 | border-bottom: 1px solid #ddd; 502 | } 503 | 504 | body img { 505 | max-width: 100%; 506 | border: 0; 507 | } 508 | 509 | body pre { 510 | color: #ab1f27; 511 | background-color: #f5f0f0; 512 | padding: 12px; 513 | overflow: auto; 514 | } 515 | 516 | body ul { 517 | margin: 1.25rem 0; 518 | padding-left: 0; 519 | } 520 | 521 | body ul li { 522 | counter-increment: this; 523 | line-height: 1.313em; 524 | list-style: none; 525 | position: relative; 526 | } 527 | 528 | body ul li:after { 529 | color: #757575; 530 | content: "-"; 531 | font-size: 100%; 532 | left: -1em; 533 | position: absolute; 534 | top: 0; 535 | } 536 | 537 | .sourceCode { 538 | background-color: #f0f0f0; 539 | color: #3d323d; 540 | font-family: "lucida console", "9x15", "DejaVu Sans Mono", "Monaco"; 541 | font-size: 1em; 542 | } 543 | .sourceCode .ot { color: #3d323d; } 544 | .sourceCode .kw { color: #3d323d; } 545 | .sourceCode .dt { color: #ab1f27; } 546 | .sourceCode .dv { color: #2536d6; } 547 | .sourceCode .st { color: #2536d6; } 548 | .sourceCode .co { 549 | color: #808080; 550 | font-style: italic; 551 | } 552 | .sourceCode .fu { color: #e347e4; } 553 | 554 | {-# START_FILE other/header.md #-} 555 | 556 | 557 | 560 | --------------------------------------------------------------------------------