Switch to fourmolu

This commit is contained in:
Sridhar Ratnakumar 2022-03-23 13:46:51 -04:00
parent ca4f5df04d
commit 63c385280e
6 changed files with 19 additions and 4 deletions

View file

@ -1,5 +1,6 @@
{
"editor.formatOnType": true,
"editor.formatOnSave": true,
"nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix"
"nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix",
"haskell.formattingProvider": "fourmolu"
}

View file

@ -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

View file

@ -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

View file

@ -39,7 +39,7 @@
cabal-install
ghcid
haskell-language-server
ormolu
fourmolu
hlint
pkgs.nixpkgs-fmt
]);

8
fourmolu.yaml Normal file
View 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

View file

@ -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