diff --git a/README.md b/README.md index 19ed576f..09e71607 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ eval "$shellHook" ## Haskell - [ormolu](https://github.com/tweag/ormolu) +- [fourmolu](https://github.com/parsonsmatt/fourmolu) - [hindent](https://github.com/chrisdone/hindent) - [stylish-haskell](https://github.com/jaspervdj/stylish-haskell) - [hlint](https://github.com/ndmitchell/hlint) diff --git a/modules/hooks.nix b/modules/hooks.nix index f132cbf1..57b829f0 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -87,6 +87,16 @@ in }"; files = "\\.l?hs$"; }; + fourmolu = + { + name = "fourmolu"; + description = "Haskell code prettifier."; + entry = + "${tools.fourmolu}/bin/fourmolu --mode inplace ${ + lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) settings.ormolu.defaultExtensions) + }"; + files = "\\.l?hs$"; + }; hindent = { name = "hindent"; diff --git a/nix/tools.nix b/nix/tools.nix index 487ac13d..3a4f00fa 100644 --- a/nix/tools.nix +++ b/nix/tools.nix @@ -27,7 +27,7 @@ { inherit ansible-lint hlint shellcheck ormolu hindent cabal-fmt nixpkgs-fmt nixfmt nix-linter rustfmt clippy cargo; inherit (elmPackages) elm-format; - inherit (haskellPackages) stylish-haskell brittany hpack; + inherit (haskellPackages) stylish-haskell brittany hpack fourmolu; inherit (pythonPackages) yamllint; inherit (nodePackages) prettier; purty = callPackage ./purty { purty = nodePackages.purty; };