-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 63d3ad3
Showing
12 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-22.04, macos-12] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Stack | ||
uses: haskell-actions/setup@v2 | ||
with: | ||
enable-stack: true | ||
stack-no-global: true | ||
|
||
- name: Cache Stack build files | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.stack | ||
.stack-work | ||
key: >- | ||
${{ runner.os }}-stack-${{ | ||
hashFiles('stack.yaml.lock', 'package.yaml') }} | ||
restore-keys: | | ||
${{runner.os}}-stack | ||
- name: Test | ||
run: stack test --ghc-options="-O2" | ||
|
||
- name: Copy binary to ~/.local/bin so it can be uploaded | ||
run: stack install | ||
|
||
- name: Upload ${{ runner.os }} Release | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: ~/.local/bin/haskell-template | ||
name: haskell-template_${{ runner.os }}_${{ runner.arch }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/.stack-work | ||
/*.cabal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Main where | ||
|
||
import Protolude (IO, putStrLn, ($)) | ||
import Lib (sayHello) | ||
|
||
main :: IO () | ||
main = do | ||
putStrLn $ sayHello "World!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Haskell Template | ||
|
||
- 2023-11-27 - 0.0.0.0 | ||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
indentation: 2 | ||
function-arrows: leading | ||
comma-style: leading | ||
import-export-style: diff-friendly | ||
indent-wheres: true | ||
record-brace-space: false | ||
newlines-between-decls: 2 | ||
haddock-style: multi-line-compact | ||
let-style: auto | ||
in-style: left-align | ||
respectful: true | ||
unicode: never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.PHONY: test | ||
test: | ||
stack test | ||
|
||
.PHONY: build | ||
build: | ||
stack build | ||
|
||
.PHONY: install | ||
install: | ||
stack install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: haskell-template | ||
version: 0.0.0.0 | ||
synopsis: A opinionated template for Haskell projects | ||
description: Please check out the README for more information. | ||
homepage: https://github.com/Airsequel/haskell-template#readme | ||
license: AGPL-3.0-or-later | ||
author: Adrian Sieber | ||
maintainer: [email protected] | ||
copyright: Adrian Sieber | ||
category: Web | ||
|
||
extra-source-files: | ||
- readme.md | ||
|
||
dependencies: | ||
- base | ||
- protolude | ||
|
||
default-extensions: | ||
- NoImplicitPrelude | ||
- OverloadedRecordDot | ||
- OverloadedStrings | ||
|
||
ghc-options: | ||
- -Wall | ||
- -Wcompat | ||
- -Wincomplete-record-updates | ||
- -Wincomplete-uni-patterns | ||
- -Wredundant-constraints | ||
- -fno-warn-orphans | ||
|
||
library: | ||
language: GHC2021 | ||
source-dirs: source | ||
|
||
executables: | ||
haskell-template: | ||
language: GHC2021 | ||
source-dirs: app | ||
main: Main.hs | ||
dependencies: | ||
- haskell-template | ||
|
||
tests: | ||
haskell-template-test: | ||
language: GHC2021 | ||
source-dirs: tests | ||
main: Spec.hs | ||
dependencies: | ||
- haskell-template | ||
- hspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Haskell Template | ||
|
||
Opinionated template for new Haskell projects. | ||
|
||
|
||
## Used Technologies | ||
|
||
- [Stack](https://docs.haskellstack.org/en/stable/README/) | ||
- [Fourmolu](https://fourmolu.github.io) | ||
- [Haskell Language Server ](https://github.com/haskell/haskell-language-server) | ||
- [Protolude](https://github.com/protolude/protolude) | ||
|
||
|
||
## Usage | ||
|
||
1. Clone this repository | ||
1. Rename the folder to your project name | ||
1. Replace all occurences of `haskell-template` with your project name | ||
1. Run `stack test` to build the project and run the tests | ||
1. Run `stack run` to run the project | ||
1. Run `stack install` to install the project (make it available in your PATH) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Lib where | ||
|
||
import Protolude (Text, (<>)) | ||
|
||
sayHello :: Text -> Text | ||
sayHello name = | ||
"Hello " <> name <> "!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resolver: lts-21.15 | ||
packages: | ||
- "." | ||
|
||
extra-deps: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file was autogenerated by Stack. | ||
# You should not edit this file by hand. | ||
# For more information, please see the documentation at: | ||
# https://docs.haskellstack.org/en/stable/lock_files | ||
|
||
packages: [] | ||
snapshots: | ||
- completed: | ||
sha256: 350737ef1c4c748f4c7ff56b6e74f2f6d15039a2f148662a8ec1aded016b80d0 | ||
size: 640033 | ||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/15.yaml | ||
original: lts-21.15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Protolude (IO, ($)) | ||
import Test.Hspec (hspec, shouldBe, describe, it) | ||
|
||
import Lib (sayHello) | ||
|
||
main :: IO () | ||
main = hspec $ do | ||
describe "Haskell Template" $ do | ||
it "prints 'Hello World!'" $ do | ||
sayHello "World" `shouldBe` "Hello World!" |