diff --git a/.vscode/settings.json b/.vscode/settings.json index de1d748..abd40a3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "editor.formatOnType": true, "editor.formatOnSave": true, - "nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix" + "nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix", + "haskell.formattingProvider": "fourmolu" } diff --git a/README.md b/README.md index 78ba201..6c0965a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # haskell-template -Haskell project template optimized for a fully reproducible and friendly development environment. Based on [Nix](http://www.srid.ca/haskell-nix) + [Flakes](https://serokell.io/blog/practical-nix-flakes) + VSCode ([HLS](https://github.com/haskell/haskell-language-server)) + [ormolu](https://github.com/tweag/ormolu) autoformatting + [Relude](https://github.com/kowainik/relude#relude) as Prelude. +Haskell project template optimized for a fully reproducible and friendly development environment. Based on [Nix](http://www.srid.ca/haskell-nix) + [Flakes](https://serokell.io/blog/practical-nix-flakes) + VSCode ([HLS](https://github.com/haskell/haskell-language-server)) + [fourmolu](https://github.com/fourmolu/fourmolu) autoformatting + [Relude](https://github.com/kowainik/relude#relude) as Prelude. ## Getting Started diff --git a/bin/format b/bin/format index 9e732c8..d9b7096 100755 --- a/bin/format +++ b/bin/format @@ -1,6 +1,6 @@ #!/usr/bin/env nix-shell #! nix-shell ../shell.nix -i bash set -xe -find src -name \*.hs | xargs ormolu -m inplace -o -XImportQualifiedPost -o -XTypeApplications +find src -name \*.hs | xargs fourmolu -m inplace -o -XImportQualifiedPost -o -XTypeApplications nixpkgs-fmt *.nix cabal-fmt -i *.cabal \ No newline at end of file diff --git a/flake.nix b/flake.nix index a3464a6..159958b 100644 --- a/flake.nix +++ b/flake.nix @@ -39,7 +39,7 @@ cabal-install ghcid haskell-language-server - ormolu + fourmolu hlint pkgs.nixpkgs-fmt ]); diff --git a/fourmolu.yaml b/fourmolu.yaml new file mode 100644 index 0000000..ef5582d --- /dev/null +++ b/fourmolu.yaml @@ -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 \ No newline at end of file diff --git a/src/Main.hs b/src/Main.hs index 175d8b3..a853643 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -2,6 +2,12 @@ module Main where import Main.Utf8 (withUtf8) +{- | + Main entry point. + + The `bin/run` script will invoke this function. See `.ghcid` file to change + that. +-} main :: IO () main = do -- For withUtf8, see https://serokell.io/blog/haskell-with-utf8