Initial commit from template
This commit is contained in:
commit
531ec6e412
12 changed files with 340 additions and 0 deletions
2
.envrc
Normal file
2
.envrc
Normal file
|
@ -0,0 +1,2 @@
|
|||
nix_direnv_watch_file *.cabal
|
||||
use flake
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
flake.lock linguist-generated=true
|
12
.gitignore
vendored
Normal file
12
.gitignore
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
# cabal
|
||||
dist
|
||||
dist-*
|
||||
cabal.project.local
|
||||
cabal.project.local~
|
||||
|
||||
# nix
|
||||
result
|
||||
result-*
|
||||
|
||||
# direnv
|
||||
.direnv
|
9
.vscode/extensions.json
vendored
Normal file
9
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"haskell.haskell",
|
||||
"mkhl.direnv",
|
||||
"bbenoist.nix"
|
||||
]
|
||||
}
|
8
.vscode/settings.json
vendored
Normal file
8
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"editor.formatOnType": true,
|
||||
"editor.formatOnSave": true,
|
||||
"nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix",
|
||||
// "nixEnvSelector.args": "--pure"
|
||||
"haskell.formattingProvider": "fourmolu",
|
||||
"haskell.manageHLS": "PATH"
|
||||
}
|
27
.vscode/tasks.json
vendored
Normal file
27
.vscode/tasks.json
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Ghcid",
|
||||
"type": "shell",
|
||||
// This is useful if you often see ghost ghcid left behind by VSCode reloads.
|
||||
"command": "nix",
|
||||
"args": [
|
||||
"develop",
|
||||
"-c",
|
||||
",",
|
||||
"run"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"runOptions": {
|
||||
// "runOn": "folderOpen"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
133
flake.lock
generated
Normal file
133
flake.lock
generated
Normal file
|
@ -0,0 +1,133 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1679737941,
|
||||
"narHash": "sha256-srSD9CwsVPnUMsIZ7Kt/UegkKUEBcTyU1Rev7mO45S0=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "3502ee99d6dade045bdeaf7b0cd8ec703484c25c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-root": {
|
||||
"locked": {
|
||||
"lastModified": 1671378805,
|
||||
"narHash": "sha256-yqGxyzMN2GuppwG3dTWD1oiKxi+jGYP7D1qUSc5vKhI=",
|
||||
"owner": "srid",
|
||||
"repo": "flake-root",
|
||||
"rev": "dc7ba6166e478804a9da6881aa48c45d300075cf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "srid",
|
||||
"repo": "flake-root",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"haskell-flake": {
|
||||
"locked": {
|
||||
"lastModified": 1679690126,
|
||||
"narHash": "sha256-u6pQejlTLC1QSKLMB/8Ch+2VvgILlxuZsBHAbDn0zHM=",
|
||||
"owner": "srid",
|
||||
"repo": "haskell-flake",
|
||||
"rev": "d63943b612dbe30e2aba8aab0e60f1011c369973",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "srid",
|
||||
"repo": "haskell-flake",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mission-control": {
|
||||
"locked": {
|
||||
"lastModified": 1679674077,
|
||||
"narHash": "sha256-hGz63fsyRGthjE6LLqB08IHApcBvHhI87gWrFN/Uu5w=",
|
||||
"owner": "Platonic-Systems",
|
||||
"repo": "mission-control",
|
||||
"rev": "d07854a616f559370b71c1c440d916ab6869f084",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Platonic-Systems",
|
||||
"repo": "mission-control",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1679734080,
|
||||
"narHash": "sha256-z846xfGLlon6t9lqUzlNtBOmsgQLQIZvR6Lt2dImk1M=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "dbf5322e93bcc6cfc52268367a8ad21c09d76fea",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1678375444,
|
||||
"narHash": "sha256-XIgHfGvjFvZQ8hrkfocanCDxMefc/77rXeHvYdzBMc8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "130fa0baaa2b93ec45523fdcde942f6844ee9f6e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-root": "flake-root",
|
||||
"haskell-flake": "haskell-flake",
|
||||
"mission-control": "mission-control",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1679588014,
|
||||
"narHash": "sha256-URkRSunu8HAp2vH2KgLogjAXckiufCDFrBs59g9uiLY=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "af75d6efe437858f9ca5535e622cfbedad1ba717",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
97
flake.nix
Normal file
97
flake.nix
Normal file
|
@ -0,0 +1,97 @@
|
|||
{
|
||||
description = "PCF implemented in haskell";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
haskell-flake.url = "github:srid/haskell-flake";
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
flake-root.url = "github:srid/flake-root";
|
||||
mission-control.url = "github:Platonic-Systems/mission-control";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
systems = nixpkgs.lib.systems.flakeExposed;
|
||||
imports = [
|
||||
inputs.haskell-flake.flakeModule
|
||||
inputs.treefmt-nix.flakeModule
|
||||
inputs.flake-root.flakeModule
|
||||
inputs.mission-control.flakeModule
|
||||
];
|
||||
perSystem = { self', system, lib, config, pkgs, ... }: {
|
||||
# The "main" project. You can have multiple projects, but this template
|
||||
# has only one.
|
||||
haskellProjects.main = {
|
||||
# packages.haskell-template.root = ./.; # Auto-discovered by haskell-flake
|
||||
overrides = self: super: { };
|
||||
devShell = {
|
||||
tools = hp: {
|
||||
treefmt = config.treefmt.build.wrapper;
|
||||
} // config.treefmt.build.programs;
|
||||
hlsCheck.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Auto formatters. This also adds a flake check to ensure that the
|
||||
# source tree was auto formatted.
|
||||
treefmt.config = {
|
||||
inherit (config.flake-root) projectRootFile;
|
||||
package = pkgs.treefmt;
|
||||
flakeFormatter = false; # For https://github.com/numtide/treefmt-nix/issues/55
|
||||
|
||||
programs.ormolu.enable = true;
|
||||
programs.nixpkgs-fmt.enable = true;
|
||||
programs.cabal-fmt.enable = true;
|
||||
programs.hlint.enable = true;
|
||||
|
||||
# We use fourmolu
|
||||
programs.ormolu.package = pkgs.haskellPackages.fourmolu;
|
||||
settings.formatter.ormolu = {
|
||||
options = [
|
||||
"--ghc-opt"
|
||||
"-XImportQualifiedPost"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Dev shell scripts.
|
||||
mission-control.scripts = {
|
||||
docs = {
|
||||
description = "Start Hoogle server for project dependencies";
|
||||
exec = ''
|
||||
echo http://127.0.0.1:8888
|
||||
hoogle serve -p 8888 --local
|
||||
'';
|
||||
category = "Dev Tools";
|
||||
};
|
||||
repl = {
|
||||
description = "Start the cabal repl";
|
||||
exec = ''
|
||||
cabal repl "$@"
|
||||
'';
|
||||
category = "Dev Tools";
|
||||
};
|
||||
fmt = {
|
||||
description = "Format the source tree";
|
||||
exec = config.treefmt.build.wrapper;
|
||||
category = "Dev Tools";
|
||||
};
|
||||
run = {
|
||||
description = "Run the project with ghcid auto-recompile";
|
||||
exec = ''
|
||||
ghcid --warnings -T :main
|
||||
'';
|
||||
category = "Primary";
|
||||
};
|
||||
};
|
||||
|
||||
# Default package.
|
||||
packages.default = self'.packages.main-haskell-template;
|
||||
|
||||
# Default shell.
|
||||
devShells.default =
|
||||
config.mission-control.installToDevShell self'.devShells.main;
|
||||
};
|
||||
};
|
||||
}
|
8
fourmolu.yaml
Normal file
8
fourmolu.yaml
Normal file
|
@ -0,0 +1,8 @@
|
|||
indentation: 2
|
||||
comma-style: leading
|
||||
record-brace-space: true
|
||||
indent-wheres: true
|
||||
diff-friendly-import-export: true
|
||||
respectful: true
|
||||
haddock-style: multi-line
|
||||
newlines-between-decls: 1
|
4
hie.yaml
Normal file
4
hie.yaml
Normal file
|
@ -0,0 +1,4 @@
|
|||
cradle:
|
||||
cabal:
|
||||
- path: "src"
|
||||
component: "exe:pcf"
|
29
pcf.cabal
Normal file
29
pcf.cabal
Normal file
|
@ -0,0 +1,29 @@
|
|||
cabal-version: 2.4
|
||||
name: pcf
|
||||
version: 0.1.0.0
|
||||
license: MIT
|
||||
author: Leon Vatthauer
|
||||
category: Web
|
||||
|
||||
-- TODO: Before hackage release.
|
||||
-- A short (one-line) description of the package.
|
||||
-- synopsis:
|
||||
|
||||
-- A longer description of the package.
|
||||
-- description:
|
||||
|
||||
-- A URL where users can report bugs.
|
||||
-- bug-reports:
|
||||
|
||||
extra-source-files:
|
||||
LICENSE
|
||||
README.md
|
||||
|
||||
common shared
|
||||
build-depends: base >=4.13.0.0 && <4.18.0.0.0
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
|
||||
executable pcf
|
||||
import: shared
|
||||
main-is: Main.hs
|
10
src/Main.hs
Normal file
10
src/Main.hs
Normal file
|
@ -0,0 +1,10 @@
|
|||
module Main where
|
||||
|
||||
{- |
|
||||
Main entry point.
|
||||
|
||||
The `, run` script will invoke this function.
|
||||
-}
|
||||
main :: IO ()
|
||||
main = do
|
||||
print "Hello world"
|
Loading…
Reference in a new issue