# connections - Composable numeric casts with Galois connections in Rust

Original title: Show HN: Galois connections for composable numeric casts in Rust

> Hacker News story 48936803 · language: en · submitted 2026-07-16
> Web version: https://zeli.app/story/48936803
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 31 · by [partialsolve](<https://news.ycombinator.com/user?id=partialsolve>) · 💬 3
[original](<https://github.com/cmk/connections>) · [HN discussion](<https://news.ycombinator.com/item?id=48936803>)

## Summary

connections is a Rust library that replaces unsafe type casting with mathematically proven, composable conversions using Galois connections. It solves the ambiguity of standard `as` casts by providing explicit semantics for rounding, saturation, and lossy conversions between numeric types. Every operation carries property-tested invariants, and complex conversion chains can be composed at compile time to ensure static correctness. With support for fixed-point, time durations, and network addresses, it offers a robust, heap-free solution for safe numeric transformations in systems programming.

## Key quote

> Use them to cast lawfully between numeric types, and compose ladders of conversions whose round-trip behavior is determined by simple inequalities rather than left to chance.

---

## Cite

- Page: https://zeli.app/story/48936803
- Date: 2026-07-16
- Source: github.com (https://github.com/cmk/connections)
- Hacker News: https://news.ycombinator.com/item?id=48936803

## Other languages

- zh: https://zeli.app/zh/story/48936803 · markdown: https://zeli.app/zh/story/48936803.md
- ja: https://zeli.app/ja/story/48936803 · markdown: https://zeli.app/ja/story/48936803.md
- ko: https://zeli.app/ko/story/48936803 · markdown: https://zeli.app/ko/story/48936803.md
- de: https://zeli.app/de/story/48936803 · markdown: https://zeli.app/de/story/48936803.md
- es: https://zeli.app/es/story/48936803 · markdown: https://zeli.app/es/story/48936803.md
