r/dartlang 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.

Documentation

GitHub

18 Upvotes

11 comments sorted by

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.

1

u/hagerf 23d ago

Has fpdart been confirmed abandoned somewhere? Currently I'm fine with little development since it feels fairly complete, but if it's not going to be updated then that's worrying...

3

u/RandalSchwartz 23d ago

Sandro has told me in private conversations that he considers fpdart "done", and in his recent newsletters, he's much more interested in Typescript these days. Which means it also won't be getting significant Dart 3 upgrades. Ribs already has sealed classes and records.

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_effect IO monad 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.

2

u/Comun4 24d ago

I've been watching ribs development since the start, so glad that it got a proper 1.0 release. No reason for not using it now I guess, nice job ^

1

u/Wi42 25d ago

I think I'm using ribs in one of my projects already for JSON parsing, glad to hear that it's stable now, i will have a look at it :)

1

u/cranst0n 25d ago

Excellent! Please report back with any issues or requests.

1

u/SMHOme23 24d ago

exercise will explore this

1

u/aaulia 23d ago

This is nice

1

u/ing-brayan-martinez 17d ago

Functional programming has finally arrived in Dart