Initial import
This commit is contained in:
commit
babdc90cef
9 changed files with 255 additions and 0 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.pre-commit-config.yaml
|
||||
result
|
||||
.direnv
|
||||
10
README.org
Normal file
10
README.org
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#+TITLE: Simple Haskell Template
|
||||
|
||||
* Simple Haskell Template
|
||||
|
||||
This template repository sets up a simple Haskell project using nix fl akes and sets up integration with
|
||||
- hpack
|
||||
- fourmolu
|
||||
- hlint
|
||||
- haskell-language-server
|
||||
- validity based testing
|
||||
6
app/hcat.hs
Normal file
6
app/hcat.hs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
module Main (main) where
|
||||
|
||||
import HCat qualified
|
||||
|
||||
main :: IO ()
|
||||
main = HCat.runHCat
|
||||
79
flake.lock
generated
Normal file
79
flake.lock
generated
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1644229661,
|
||||
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1661626419,
|
||||
"narHash": "sha256-CjdPtdwH7I5Es4SjdCGuNfeulIyaM1LP0dXGWi4dyuQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a5e05d62460ff0b7627559a8b55ab421041ebf0a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660830093,
|
||||
"narHash": "sha256-HUhx3a82C7bgp2REdGFeHJdhEAzMGCk3V8xIvfBqg1I=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "8cb8ea5f1c7bc2984f460587fddd5f2e558f6eb8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
74
flake.nix
Normal file
74
flake.nix
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
description = "Haskell file poger (Effective Haskell)";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
||||
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, pre-commit-hooks }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
||||
haskellPackages = pkgs.haskell.packages.ghc924;
|
||||
|
||||
jailbreakUnbreak = pkg:
|
||||
pkgs.haskell.lib.doJailbreak (pkg.overrideAttrs (_: { meta = { }; }));
|
||||
|
||||
packageName = "hcat";
|
||||
in {
|
||||
packages.${packageName} = haskellPackages.callCabal2nix packageName self
|
||||
rec {
|
||||
# Dependency overrides go here
|
||||
};
|
||||
|
||||
defaultPackage = self.packages.${system}.${packageName};
|
||||
|
||||
apps = {
|
||||
# run with: nix run #.hcat
|
||||
hcat = {
|
||||
type = "app";
|
||||
program = "${self.defaultPackage.${system}}/bin/hcat";
|
||||
};
|
||||
|
||||
# run with: nix run
|
||||
default = self.apps.${system}.hcat;
|
||||
};
|
||||
|
||||
checks = {
|
||||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
nixfmt.enable = true;
|
||||
fourmolu.enable = true;
|
||||
hpack.enable = true;
|
||||
hlint.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
devShell = haskellPackages.shellFor {
|
||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||
|
||||
packages = p: [ self.defaultPackage.${system} ];
|
||||
|
||||
withHoogle = true;
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
haskellPackages.haskell-language-server
|
||||
haskellPackages.fourmolu
|
||||
cabal-install
|
||||
ghcid
|
||||
nixfmt
|
||||
hpack
|
||||
hlint
|
||||
];
|
||||
inputsFrom = builtins.attrValues self.packages.${system};
|
||||
};
|
||||
});
|
||||
}
|
||||
40
hcat.cabal
Normal file
40
hcat.cabal
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
cabal-version: 1.12
|
||||
|
||||
-- This file has been generated from package.yaml by hpack version 0.34.4.
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
|
||||
name: hcat
|
||||
version: 0.0.1.0
|
||||
description: Hcat example from the book 'Effective Haskell'
|
||||
author: Alexander Kobjolke
|
||||
maintainer: alex@jakalx.net
|
||||
copyright: Alexander Kobjolke 2023
|
||||
license: MIT
|
||||
build-type: Simple
|
||||
extra-source-files:
|
||||
README.org
|
||||
|
||||
library
|
||||
exposed-modules:
|
||||
HCat
|
||||
other-modules:
|
||||
Paths_hcat
|
||||
hs-source-dirs:
|
||||
src
|
||||
ghc-options: -Wall -Wunused-packages
|
||||
build-depends:
|
||||
base >=4.13 && <5
|
||||
default-language: GHC2021
|
||||
|
||||
executable hcat
|
||||
main-is: hcat.hs
|
||||
other-modules:
|
||||
Paths_hcat
|
||||
hs-source-dirs:
|
||||
app
|
||||
ghc-options: -Wall -Wunused-packages
|
||||
build-depends:
|
||||
base >=4.13 && <5
|
||||
, hcat
|
||||
default-language: GHC2021
|
||||
36
package.yaml
Normal file
36
package.yaml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
name: hcat
|
||||
version: 0.0.1.0
|
||||
license: MIT
|
||||
author: "Alexander Kobjolke"
|
||||
maintainer: "alex@jakalx.net"
|
||||
copyright: "Alexander Kobjolke 2023"
|
||||
description: "Hcat example from the book 'Effective Haskell'"
|
||||
|
||||
extra-source-files:
|
||||
- README.org
|
||||
|
||||
dependencies:
|
||||
- base >= 4.13 && < 5
|
||||
# - bytestring
|
||||
# - text
|
||||
# - time
|
||||
# - process
|
||||
# - directory
|
||||
|
||||
ghc-options:
|
||||
- -Wall
|
||||
- -Wunused-packages
|
||||
|
||||
library:
|
||||
source-dirs: src
|
||||
verbatim:
|
||||
default-language: GHC2021
|
||||
|
||||
executables:
|
||||
hcat:
|
||||
source-dirs: app
|
||||
main: hcat.hs
|
||||
dependencies:
|
||||
- hcat
|
||||
verbatim:
|
||||
default-language: GHC2021
|
||||
6
src/HCat.hs
Normal file
6
src/HCat.hs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
module HCat (
|
||||
runHCat,
|
||||
) where
|
||||
|
||||
runHCat :: IO ()
|
||||
runHCat = pure ()
|
||||
Loading…
Add table
Add a link
Reference in a new issue