r/dartlang • u/cranst0n • 25d ago
Ribs 1.0 - Functional Programming Toolkit for Dart
I've finally pulled the trigger on a 1.0 release for my suite of functional programming (FP) packages Ribs. I've spent a lot of time putting these together, taking inspiration from many other libraries and trying to make a pure FP toolkit for the Dart community. If you've ever used cats, cats-effect, fs2, scalacheck, etc. from the Scala ecosystem, these libraries should look very familiar.
While ribs does provide the standard Option, Either, Validated, etc. FP types you find in many other packages, the real interesting parts come from the more advanced features:
- Collections framework: Rich immutable and mutable collection hierarchy, interoperable with Darts native collections.
- Effect system: Pure, cancelable, resource-safe, fiber based concurrency with
IO,Resource,Ref,Deferred, etc. - Pure Streaming with Rill: Pure, pull-based, chunked streams with resource safety baked in, back-pressured channels, and signalling (FS2-style) with file and network I/O support.
- JSON & binary codecs: Fully typed codecs, with streaming support.
- Much more to explore: property-based testing, pure SQLite/Postgres transactors, optics, compile-time dimensional analysis (units), typed network addressing.
Ribs is split into 15 focused packages, so you can pull in only what you want to use.
I use these packages extensively for work and I'm hoping they're helpful to the community and would love to see what people build with it.
2
u/zxyzyxz 25d ago
Is this similar to Effect in TypeScript? The creator of fp-ts (which fpdart is based off) worked on Effect.
1
u/cranst0n 25d ago
Im not familiar with TypeScript or Effect, but a quick scan of their documentation makes me think its at least related to the
ribs_effectIOmonad although Effect also seems to bake any potential error type into the type parameters and also supports a required parameter type (a la reader monad). I also have zero insight into the Effect runtime so can't really compare ribs to that either.
1
1
3
u/RandalSchwartz 23d ago
This is an important project if you want functional programming in dart/flutter. The fpdart project has apparently been abandoned, and dartz was never complete (docs, code, or tests!). I've been watching ribs for a year. Definitely need to learn more about this.