Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Refined: Simple Refinement Types for Rust (jordankaye.dev)
4 points by pierremenard 4 months ago | hide | past | favorite | 1 comment



I'm not convinced this is in practice better than a newtype with a hand-written `pub fn new(...)` that returns Option or Result. Sure, you get And/Or from the library, but the cognitive overhead is not free!

Also, the post talks about how one should prefer parsers over validators, but the library `refined` actually makes you to write validators not parsers: https://docs.rs/refined/latest/refined/trait.Predicate.html -- the library them combines validatators




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: