Replicant - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

James King

Hello Haskellers!

Announcing a new library: Replicant

It enables you to stream changes from your PostgreSQL database to Haskell.

This experimental candidate release is meant for developers to test, report errors and missing features. Please feel free to report errors or submit requests to the Github repository. There are some known issues! It's not production ready yet. See the README for more details. Contributions welcome although it's still early days so there's no guidelines or anything yet. I'm availabe on here, Slack, and on reddit if you have any questions.

Reddit announce thread here: https://www.reddit.com/r/haskell/comments/n3hvtw/announce_postgresqlreplicant0100candidate/

Thanks a bunch!

A streaming PostgreSQL logical replication client library for Haskell - agentultra/postgresql-replicant
Torsten Schmits

awesome! I will surely give that a try, I'm using notifications at the moment

Sridhar Ratnakumar

a) How do you position this in relation to postgrest?
b) Is there an example application, demonstrating the common use cases?

James King

Sridhar Ratnakumar said:

a) How do you position this in relation to postgrest?
b) Is there an example application, demonstrating the common use cases?

a) this would be an awesome library to use with postgrest! Your current options for doing async processing of data in Haskell is to use the SUBSCRIBE/NOTIFY system which has some limitations that the approach this library uses doesn't. The trade off is that the Postgres user that connects using this library must have replication privileges.

b) There isn't _yet_. I have some plans for some internal projects at my company but one common use for a library like this is to combine it with a web socket server and enable your web application front-end to receive real-time updates, a lot like Firebase. This is the low-level library you'd need to get the change stream out of Postgres into something else. Once this library is in a good state I'm planning on adding conduit and pipes support so that you can use your Postgres database as a source.

Sridhar Ratnakumar

One interesting idea to explore is a full-stack FRP app, that spans the FRP network from frontend to the backend (and the database). We take reflex, postgrest, replicant and mash em up together. And write TodoMVC on it, such that if you have the app open in two browser windows - adding a task through one window, automatically has the other window update (thanks to FRP).