Skip to content

Commit 07fcd06

Browse files
committed
Initial setup
1 parent f7b0743 commit 07fcd06

File tree

9 files changed

+148
-0
lines changed

9 files changed

+148
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.iml
2+
.idea/
3+
.stack-work/

Setup.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain

app/Main.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Main where
2+
3+
import Data.String.Strip
4+
5+
main :: IO ()
6+
main = interact strip

haskell-template-project.cabal

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: haskell-template-project
2+
version: 0.1.0.0
3+
-- synopsis:
4+
-- description:
5+
homepage: https://github.com/PHPirates/haskell-template-project
6+
license: MIT
7+
license-file: LICENSE
8+
author: Thomas Schouten
9+
maintainer: [email protected]
10+
copyright: MIT
11+
category: Template
12+
build-type: Simple
13+
extra-source-files: readme.rst
14+
cabal-version: >=1.10
15+
16+
library
17+
hs-source-dirs: src
18+
exposed-modules: Data.String.Strip
19+
build-depends: base >= 4.7 && < 5
20+
default-language: Haskell2010
21+
22+
executable haskell-template-project
23+
hs-source-dirs: app
24+
main-is: Main.hs
25+
ghc-options: -threaded -rtsopts -with-rtsopts=-N
26+
build-depends: base
27+
, haskell-template-project
28+
default-language: Haskell2010
29+
30+
test-suite haskell-template-project-test
31+
type: exitcode-stdio-1.0
32+
hs-source-dirs: test
33+
main-is: Spec.hs
34+
build-depends: base
35+
, haskell-template-project
36+
, hspec
37+
, QuickCheck
38+
ghc-options: -threaded -rtsopts -with-rtsopts=-N
39+
default-language: Haskell2010
40+
41+
source-repository head
42+
type: git
43+
location: https://github.com/PHPirates/haskell-template-project

readme.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Instructions to install Haskell and the IntelliJ Haskell plugin at StackOverflow_.
2+
3+
.. _StackOverflow: https://stackoverflow.com/a/51009817/4126843

src/Data/String/Strip.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Data.String.Strip (strip) where
2+
3+
import Data.Char
4+
5+
strip :: String -> String
6+
strip = dropWhile isSpace . reverse . dropWhile isSpace . reverse

stack.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This file was automatically generated by 'stack init'
2+
#
3+
# Some commonly used options have been documented as comments in this file.
4+
# For advanced use and comprehensive documentation of the format, please see:
5+
# https://docs.haskellstack.org/en/stable/yaml_configuration/
6+
7+
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
8+
# A snapshot resolver dictates the compiler version and the set of packages
9+
# to be used for project dependencies. For example:
10+
#
11+
# resolver: lts-3.5
12+
# resolver: nightly-2015-09-21
13+
# resolver: ghc-7.10.2
14+
# resolver: ghcjs-0.1.0_ghc-7.10.2
15+
#
16+
# The location of a snapshot can be provided as a file or url. Stack assumes
17+
# a snapshot provided as a file might change, whereas a url resource does not.
18+
#
19+
# resolver: ./custom-snapshot.yaml
20+
# resolver: https://example.com/snapshots/2018-01-01.yaml
21+
resolver: lts-11.16
22+
23+
# User packages to be built.
24+
# Various formats can be used as shown in the example below.
25+
#
26+
# packages:
27+
# - some-directory
28+
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
29+
# - location:
30+
# git: https://github.com/commercialhaskell/stack.git
31+
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
32+
# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
33+
# subdirs:
34+
# - auto-update
35+
# - wai
36+
packages:
37+
- .
38+
# Dependency packages to be pulled from upstream that are not in the resolver
39+
# using the same syntax as the packages field.
40+
# (e.g., acme-missiles-0.3)
41+
# extra-deps: []
42+
43+
# Override default flag values for local packages and extra-deps
44+
# flags: {}
45+
46+
# Extra package databases containing global packages
47+
# extra-package-dbs: []
48+
49+
# Control whether we use the GHC we find on the path
50+
# system-ghc: true
51+
#
52+
# Require a specific version of stack, using version ranges
53+
# require-stack-version: -any # Default
54+
# require-stack-version: ">=1.7"
55+
#
56+
# Override the architecture used by stack, especially useful on Windows
57+
# arch: i386
58+
# arch: x86_64
59+
#
60+
# Extra directories used by stack for building
61+
# extra-include-dirs: [/path/to/dir]
62+
# extra-lib-dirs: [/path/to/dir]
63+
#
64+
# Allow a newer minor version of GHC than the snapshot specifies
65+
# compiler-check: newer-minor

test/Data/String/StripSpec.hs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module Data.String.StripSpec (main, spec) where
2+
3+
import Test.Hspec
4+
import Test.QuickCheck
5+
6+
import Data.String.Strip
7+
8+
-- `main` is here so that this module can be run from GHCi on its own. It is
9+
-- not needed for automatic spec discovery.
10+
main :: IO ()
11+
main = hspec spec
12+
13+
spec :: Spec
14+
spec = do
15+
describe "strip" $ do
16+
it "removes leading and trailing whitespace" $ do
17+
strip "\t foo bar\n" `shouldBe` "foo bar"
18+
it "is idempotent" $ property $
19+
\str -> strip str === strip (strip str)

test/Spec.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}

0 commit comments

Comments
 (0)