Skip to content

Releases: shwestrick/smlfmt

v1.3.0 (Jan 1, 2026)

Choose a tag to compare

@shwestrick shwestrick released this 01 Jan 19:11

Happy new year! A few small updates in this release:

  • #101: comments at the end of a file format more nicely now
  • #103: added support for -mlb-path-map FILE option. (Thanks @ratsclub !)

v1.2.0 (May 2, 2025)

Choose a tag to compare

@shwestrick shwestrick released this 02 May 16:35

A couple new features in this release:

  • #100: better formatting for monadic-do-style infix expressions
  • #99: expanded support for SuccessorML features, and -allow-successor-ml command-line flag

And bugfixes:

  • #95: fix Makefile install target

Thank you @ii8, @DarinM223, @p-ouellette for your contributions!

v1.1.0 (Nov 2, 2023)

Choose a tag to compare

@shwestrick shwestrick released this 02 Nov 15:25

In this release:

  • #77: --safety-check flag for checking that the output of smlfmt is correct, i.e., that the result is valid SML that exactly matches the source except for whitespace.
    • Note: originally called --check but renamed to --safety-check in #92.
  • #84, #86: allow passing input and output through stdin and stdout.
    • For example: echo "val x = 5 val y = 6" | ./smlfmt or cat test.sml | ./smlfmt > output.sml
  • #87: --read-only flag, useful for checking for syntax errors
  • #93: make install formula
  • #92: --check flag, to check if a file has already been formatted. Useful for CI.
  • Some bugfixes and other small improvements, e.g., 656885b 4d1952a

Also note that https://github.com/diku-dk/smlfmt.el offers Emacs integration for smlfmt.

Thanks @kopecs @p-ouellette @brandonspark @athas @ratsclub for your contributions!

v1.0.0 (Jan 10, 2023)

Choose a tag to compare

@shwestrick shwestrick released this 10 Jan 17:09
5188a13

smlfmt is a custom parser and code formatter for Standard ML.

Features

  • Full support for Standard ML according to the formal definition.
  • Fast -- see performance results below.
  • Usable for large projects.
    • Whole-project formatting via .mlb files using MLton conventions.
  • Helpful error messages with visual code references and syntax highlighting.
  • Support for various SuccessorML syntax extensions.
  • Configurable indentation size and maximum width.

Performance

smlfmt is fast enough for live reformatting on large individual files, and can reformat large projects in seconds.

Here are measurements for smlfmt --preview-only INPUT > out on my MacBook Air (M2, 2022).

Input Size (LoC) Time
src/prettier-print/PrettierExpAndDec.sml 1024 31 ms
src/base/PrettyTabbedDoc.sml 1349 29 ms
src/parse/ParseExpAndDec.sml 1363 28 ms
MLton elaborate-core.fun 3942 104 ms
MLton x86-allocate-registers.fun 11034 216 ms
Entire MLton source code (mlton.mlb) 160000 (approx.) 6.6s

(Timings are averages reported by hyperfine.)