finds.dev

stephencelis/Formatting

Type-safe, functional string formatting in Swift.

View on GitHub

★ 247SwiftMITupdated Feb 2017

// the take

A Swift port of Haskell's formatting library that uses function composition and custom operators to build type-safe format strings. Instead of interpolation or printf-style placeholders, you chain formatters with % and <> operators. The target audience is Swift developers who want compile-time guarantees on string formatting.

The core idea is sound — printf-style format strings are a well-known source of type errors, and this solves that problem correctly. The curried formatter pattern is genuinely useful for partial application (e.g. pre-fixing log levels). The operator design (%, <>, .%) maps cleanly onto Haskell's original without feeling alien in Swift. It ships with date formatters out of the box, which covers the messiest real-world formatting case.

Abandoned in February 2017 — last touched when Swift 3 was current, now nine years stale. Swift's string interpolation has improved dramatically since then, and the problem this solves is largely a non-issue in modern Swift where type mismatches in interpolation don't silently produce 'Optional(...)' in most practical cases. 247 stars and 6 forks after nearly a decade tells you adoption never took off, likely because the operator-heavy DSL is harder to read than the interpolation it replaces. No Swift Package Index listing, no Xcode project update, almost certainly won't build without modification against a current toolchain.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
247
Forks
6
Language
Swift
License
MIT
Last commit
11 Feb 2017

// nearby

If Formatting isn't quite it.

All repos →