Skip to content

Commit 63d3ad3

Browse files
authored
Initial commit
0 parents  commit 63d3ad3

File tree

12 files changed

+189
-0
lines changed

12 files changed

+189
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
build:
10+
strategy:
11+
matrix:
12+
os: [ubuntu-22.04, macos-12]
13+
runs-on: ${{ matrix.os }}
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Stack
19+
uses: haskell-actions/setup@v2
20+
with:
21+
enable-stack: true
22+
stack-no-global: true
23+
24+
- name: Cache Stack build files
25+
uses: actions/cache@v3
26+
with:
27+
path: |
28+
~/.stack
29+
.stack-work
30+
key: >-
31+
${{ runner.os }}-stack-${{
32+
hashFiles('stack.yaml.lock', 'package.yaml') }}
33+
restore-keys: |
34+
${{runner.os}}-stack
35+
36+
- name: Test
37+
run: stack test --ghc-options="-O2"
38+
39+
- name: Copy binary to ~/.local/bin so it can be uploaded
40+
run: stack install
41+
42+
- name: Upload ${{ runner.os }} Release
43+
uses: actions/upload-artifact@v3
44+
with:
45+
path: ~/.local/bin/haskell-template
46+
name: haskell-template_${{ runner.os }}_${{ runner.arch }}

.gitignore

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

app/Main.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module Main where
2+
3+
import Protolude (IO, putStrLn, ($))
4+
import Lib (sayHello)
5+
6+
main :: IO ()
7+
main = do
8+
putStrLn $ sayHello "World!"

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Haskell Template
2+
3+
- 2023-11-27 - 0.0.0.0
4+
- Initial release

fourmolu.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
indentation: 2
2+
function-arrows: leading
3+
comma-style: leading
4+
import-export-style: diff-friendly
5+
indent-wheres: true
6+
record-brace-space: false
7+
newlines-between-decls: 2
8+
haddock-style: multi-line-compact
9+
let-style: auto
10+
in-style: left-align
11+
respectful: true
12+
unicode: never

makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.PHONY: test
2+
test:
3+
stack test
4+
5+
.PHONY: build
6+
build:
7+
stack build
8+
9+
.PHONY: install
10+
install:
11+
stack install

package.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: haskell-template
2+
version: 0.0.0.0
3+
synopsis: A opinionated template for Haskell projects
4+
description: Please check out the README for more information.
5+
homepage: https://github.com/Airsequel/haskell-template#readme
6+
license: AGPL-3.0-or-later
7+
author: Adrian Sieber
8+
maintainer: github@ad-si.com
9+
copyright: Adrian Sieber
10+
category: Web
11+
12+
extra-source-files:
13+
- readme.md
14+
15+
dependencies:
16+
- base
17+
- protolude
18+
19+
default-extensions:
20+
- NoImplicitPrelude
21+
- OverloadedRecordDot
22+
- OverloadedStrings
23+
24+
ghc-options:
25+
- -Wall
26+
- -Wcompat
27+
- -Wincomplete-record-updates
28+
- -Wincomplete-uni-patterns
29+
- -Wredundant-constraints
30+
- -fno-warn-orphans
31+
32+
library:
33+
language: GHC2021
34+
source-dirs: source
35+
36+
executables:
37+
haskell-template:
38+
language: GHC2021
39+
source-dirs: app
40+
main: Main.hs
41+
dependencies:
42+
- haskell-template
43+
44+
tests:
45+
haskell-template-test:
46+
language: GHC2021
47+
source-dirs: tests
48+
main: Spec.hs
49+
dependencies:
50+
- haskell-template
51+
- hspec

readme.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Haskell Template
2+
3+
Opinionated template for new Haskell projects.
4+
5+
6+
## Used Technologies
7+
8+
- [Stack](https://docs.haskellstack.org/en/stable/README/)
9+
- [Fourmolu](https://fourmolu.github.io)
10+
- [Haskell Language Server ](https://github.com/haskell/haskell-language-server)
11+
- [Protolude](https://github.com/protolude/protolude)
12+
13+
14+
## Usage
15+
16+
1. Clone this repository
17+
1. Rename the folder to your project name
18+
1. Replace all occurences of `haskell-template` with your project name
19+
1. Run `stack test` to build the project and run the tests
20+
1. Run `stack run` to run the project
21+
1. Run `stack install` to install the project (make it available in your PATH)

source/Lib.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module Lib where
2+
3+
import Protolude (Text, (<>))
4+
5+
sayHello :: Text -> Text
6+
sayHello name =
7+
"Hello " <> name <> "!"

stack.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resolver: lts-21.15
2+
packages:
3+
- "."
4+
5+
extra-deps: []

stack.yaml.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file was autogenerated by Stack.
2+
# You should not edit this file by hand.
3+
# For more information, please see the documentation at:
4+
# https://docs.haskellstack.org/en/stable/lock_files
5+
6+
packages: []
7+
snapshots:
8+
- completed:
9+
sha256: 350737ef1c4c748f4c7ff56b6e74f2f6d15039a2f148662a8ec1aded016b80d0
10+
size: 640033
11+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/15.yaml
12+
original: lts-21.15

tests/Spec.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Protolude (IO, ($))
2+
import Test.Hspec (hspec, shouldBe, describe, it)
3+
4+
import Lib (sayHello)
5+
6+
main :: IO ()
7+
main = hspec $ do
8+
describe "Haskell Template" $ do
9+
it "prints 'Hello World!'" $ do
10+
sayHello "World" `shouldBe` "Hello World!"

0 commit comments

Comments
 (0)