Skip to content

Instantly share code, notes, and snippets.

@ENvironmentSet
Forked from Ailrun/hpack.hsfiles
Created August 5, 2020 13:31
Show Gist options
  • Save ENvironmentSet/4763bcb61234fbad83fb992d51bafd10 to your computer and use it in GitHub Desktop.
Save ENvironmentSet/4763bcb61234fbad83fb992d51bafd10 to your computer and use it in GitHub Desktop.
Stack templates
{-# START_FILE package.yaml #-}
spec-version: 0.31.0
name: {{name}}
version: 0.1.0.0
# synopsis:
# description:
category: {{category}}{{^category}}Web{{/category}}
homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme
bug-reports: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}/issues
author: {{author-name}}{{^author-name}}Author name here{{/author-name}}
maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}}
copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2017{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}}
license: BSD3
license-file: LICENSE
# tested-with:
# build-type:
extra-source-files:
- README.md
# extra-doc-files:
# data-files:
# data-dir:
github: {{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}
# custom-setup:
# dependencies:
# flags:
library:
## Common fields
source-dirs:
- src
## Library fields
# exposed:
# exposed-modules:
# generated-exposed-modules:
# other-modules:
# generated-other-modules:
# reexported-modules:
# signatures:
# internal-libraries:
executables:
{{name}}:
## Common fields
source-dirs:
- app
ghc-options: -threaded -rtsopts -with-rtsopts=-N
dependencies:
- {{name}}
## Executable fields
main: Main.hs
# other-modules:
# generated-other-modules:
# executable:
tests:
{{name}}-test:
## Common fields
source-dirs:
- test
ghc-options: -threaded -rtsopts -with-rtsopts=-N
dependencies:
- {{name}}
- hspec
- QuickCheck
## Test fields
main: Spec.hs
# other-modules:
# generated-other-modules:
# benchmarks:
# defaults:
# github:
# ref:
# path:
# local:
## Common fields
# buildable:
# source-dirs:
# default-extensions:
# other-extensions:
# ghc-options:
# ghc-prof-options:
# ghcjs-options:
# cpp-options:
# cc-options:
# c-sources:
# cxx-options:
# cxx-sources:
# js-sources:
# extra-lib-dirs:
# extra-libraries:
# include-dirs:
# install-includes:
# frameworks:
# extra-frameworks-dirs:
# ld-options:
dependencies:
- base >= 4.7 && < 5
# pkg-config-dependencies:
# build-tools:
# system-build-tools:
# when:
{-# START_FILE .gitignore #-}
# Haskell
*.hi
*.o
# Cabal
*.cabal
# Haskell Tool Stack
.stack-work/
dist/
# Emacs
*~
{-# START_FILE Setup.hs #-}
import Distribution.Simple
main = defaultMain
{-# START_FILE test/Spec.hs #-}
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
{-# START_FILE test/Data/String/StripSpec.hs #-}
module Data.String.StripSpec
( main
, spec
)
where
import Test.Hspec
import Test.QuickCheck
import Data.String.Strip
-- `main` is here so that this module can be run from GHCi on its own. It is
-- not needed for automatic spec discovery.
main :: IO ()
main = hspec spec
spec :: Spec
spec = do
describe "strip" $ do
it "removes leading and trailing whitespace" $ do
strip "\t foo bar\n" `shouldBe` "foo bar"
it "is idempotent" $ property $
\str -> strip str === strip (strip str)
{-# START_FILE src/Data/String/Strip.hs #-}
module Data.String.Strip (strip) where
import Data.Char
strip :: String -> String
strip = dropWhile isSpace . reverse . dropWhile isSpace . reverse
{-# START_FILE app/Main.hs #-}
module Main where
import Data.String.Strip
main :: IO ()
main = interact strip
{-# START_FILE LICENSE #-}
Copyright {{year}}{{^year}}2019{{/year}}-present {{author-name}}{{^author-name}}Author name here{{/author-name}}
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{-# START_FILE README.md #-}
# {{name}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment