At the moment, we only expose a withFoundationDB function, which sets up the network and connects to the database. Because it does both, it can't be used to connect to multiple databases.
Let's add a separate withNetwork function (with a warning to only call it once) and a separate withDatabase function for advanced use cases when we want to connect to multiple databases.
As pointed out here, https://github.com/crclark/foundationdb-haskell/pull/48#issuecomment-1002876006, connecting to multiple databases within a single process is allowed, but setting up multiple network threads is not.
At the moment, we only expose a
withFoundationDB
function, which sets up the network and connects to the database. Because it does both, it can't be used to connect to multiple databases.Let's add a separate
withNetwork
function (with a warning to only call it once) and a separatewithDatabase
function for advanced use cases when we want to connect to multiple databases.