1
Fork 0

Initial commit

main
Joshua Potter 2022-03-11 08:44:02 -05:00
commit 64c2f3fd0e
9 changed files with 238 additions and 0 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

13
.githooks/pre-commit Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -e
filesToFormat=$(
git --no-pager diff --name-status --no-color --cached | \
awk '$1 != "D" && $2 ~ /\.hs/ {print $NF}'
)
for path in $filesToFormat
do
google-java-format --replace $path
git add $path
done;

35
.gitignore vendored Normal file
View File

@ -0,0 +1,35 @@
# direnv
*.sw?
.direnv
.gopath
/direnv
/direnv.test
/dist
/test/config
/test/data
/test/scenarios/inherited/.envrc
# haskell
dist
dist-*
cabal-dev
*.o
*.hi
*.hie
*.chi
*.chs.h
*.dyn_o
*.dyn_hi
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
*.prof
*.aux
*.hp
*.eventlog
.stack-work/
cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*

10
README.md Normal file
View File

@ -0,0 +1,10 @@
# hello-world
## Formatting
A `pre-commit` file is included in `.githooks` to ensure consistent formatting.
Run the following to configure `git` to using it:
```bash
git config --local core.hooksPath .githooks/
```

4
app/Main.hs Normal file
View File

@ -0,0 +1,4 @@
module Main where
main :: IO ()
main = putStrLn "Hello, World!"

43
flake.lock Normal file
View File

@ -0,0 +1,43 @@
{
"nodes": {
"flake-utils": {
"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": 1646011258,
"narHash": "sha256-+aen4zu5uVp52arEcgL2maCS0zQDuG1t+Azwd/O1gN4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a25df4c2b79c4343bcc72ad671200e5a3e286c41",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-21.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

50
flake.nix Normal file
View File

@ -0,0 +1,50 @@
{
description = "A minimal Haskell flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils }: {
overlay = final: prev: {
hello-world = prev.haskellPackages.callCabal2nix "hello-world" self { };
};
} // (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlay ];
};
haskell = {
ghc = pkgs.haskellPackages.ghc;
hls = pkgs.haskell-language-server.override {
supportedGhcVersions = [ "8107" ];
};
};
in
with pkgs; {
packages = { inherit hello-world; };
defaultPackage = self.packages.${system}.hello-world;
devShell = mkShell {
buildInputs = lib.attrValues self.packages.${system} ++ [
haskell.ghc
haskell.hls
gdb
# GHC depends on LANG so need this package to properly interpret our
# files with e.g. tasty-discover.
# https://www.reddit.com/r/Nix/comments/jyczts/nixshell_locale_issue/
glibcLocales
haskellPackages.cabal-install
haskellPackages.ormolu
haskellPackages.tasty-discover
];
};
}));
}

80
hello-world.cabal Normal file
View File

@ -0,0 +1,80 @@
cabal-version: 3.0
name: hello-world
version: 0.1.0.0
synopsis: The Corner programming language.
-- A longer description of the package.
-- description:
-- license:
author: <author>
maintainer: <author>@<email>.com
bug-reports: https://github.com/<owner>/<repo>/issues
-- A copyright notice.
-- copyright:
-- category:
extra-source-files:
CHANGELOG.md
README.md
common hello-world-common
default-language: Haskell2010
default-extensions: BangPatterns,
BinaryLiterals,
ConstrainedClassMethods,
ConstraintKinds,
DeriveDataTypeable,
DeriveFoldable,
DeriveFunctor,
DeriveGeneric,
DeriveLift,
DeriveTraversable,
DoAndIfThenElse,
EmptyCase,
EmptyDataDecls,
EmptyDataDeriving,
ExistentialQuantification,
ExplicitForAll,
-- Enabled by default, but not supported by ghc-8.10.
-- FieldSelectors,
FlexibleContexts,
FlexibleInstances,
ForeignFunctionInterface,
GADTSyntax,
GeneralisedNewtypeDeriving,
HexFloatLiterals,
ImplicitPrelude,
ImportQualifiedPost,
InstanceSigs,
KindSignatures,
MonomorphismRestriction,
MultiParamTypeClasses,
NamedFieldPuns,
NamedWildCards,
NumericUnderscores,
PatternGuards,
PolyKinds,
PostfixOperators,
RankNTypes,
RelaxedPolyRec,
ScopedTypeVariables,
StandaloneDeriving,
StandaloneKindSignatures,
StarIsType,
TraditionalRecordSyntax,
TupleSections,
TypeApplications,
TypeOperators,
TypeSynonymInstances
build-depends: base,
relude
mixins: base hiding (Prelude),
relude (Relude as Prelude),
relude
ghc-options: -Wall
executable hello-world
import: hello-world-common
main-is: Main.hs
hs-source-dirs: app

2
hie.yaml Normal file
View File

@ -0,0 +1,2 @@
cradle:
cabal: