Skip to content
SPECIFICTION
Get listed

Fourmolu vs Scalafmt

Fourmolu

fourmolu.github.io

Scalafmt

scalameta.org

Side by side

FigureFourmoluScalafmt
Price fromFreeFree
Free planYesYes
Free trial——
Open source——
WebYes—
WindowsYesYes
macOS—Yes
LinuxYesYes
Self-hosted—Yes
Plans published11
Spec score · Code Formatting Tools8.3 (#4)7.6 (#22)
ConfigurationSettings can be provided in a fourmolu.yaml file or as command-line options.Formatting options are set in a plain text .scalafmt.conf file using HOCON syntax.
PurposeFourmolu formats Haskell source code and is a configurable fork of Ormolu.Scalafmt is a code formatter for Scala that formats code consistently across a team.

Plans

Fourmolu

  • FourmoluFree

Fourmolu pricing →

Scalafmt

  • FreeFree

Scalafmt pricing →

In their own words

Fourmolu

Fourmolu is a configurable formatter for Haskell source code and a fork of Ormolu. It uses GHC’s parser and aims to keep diffs small, produce idempotent output, and handle large projects. Set formatting options in `fourmolu.yaml` or pass them on the command line. Controls include indentation, line length, import grouping, record layout, Haddock comments, Unicode output, and operator fixities. Fourmolu can find the relevant Cabal file to read default extensions and dependencies that help determine fixities. Magic comments can disable formatting for selected code, and command-line options can target a line region. There is an interactive browser demo with configurable formatting and program options. Installation instructions cover GHCup, Cabal, Stack, and dotslash; editor integration is documented through Haskell Language Server. The project recommends a GitHub Action to keep projects formatted. Its listed current release is v0.21.0.0. CPP handling is experimental and limited to simple cases where conditionals surround top-level declarations. Output always uses LF line endings, which can cause check mode to fail on CRLF files.

Visit fourmolu.github.io

Scalafmt

Scalafmt is a free Scala code formatter for keeping formatting consistent across a team. It handles Scala 2, Scala 3, sbt files and Scala scripts, with one dialect selected for each file. Formatting options are stored in a plain-text .scalafmt.conf file using HOCON syntax. Since version 3.1.0, the configuration must explicitly specify both the version and runner.dialect. Scalafmt can run from an editor, build tool or terminal. Documented editor integrations include IntelliJ, VS Code, Vim, NeoVim, Emacs, Sublime Text and Eclipse; Metals supports formatting requests from editors. It integrates with sbt and documents integrations for Maven, Gradle and Mill. Command-line check and test modes report misformatted code without writing changes. It also supports ignoring files, changed-lines formatting and a library API. IntelliJ range formatting uses IntelliJ’s own formatter by default: Scalafmt is designed primarily for whole files, and selected ranges may produce undesirable results. The project license is Apache-2.0.

Visit scalameta.org