Open squalus opened 4 months ago
Do you have a proof of concept/example or just a signature of withConnection
function?
Might be useful to have some draft to talk about, while current runStore
is mostly just a reader monad wrapping underlying connection I haven't actually tried writing a multi-store client with dynamic number of stores (nor static!) so I have no idea tbh.
Writing an application that connects to several different Nix stores concurrently (with the number variable at runtime) is quite awkward. It would require either:
1) Create a monad transformer that can store a runtime-variable list of monads and allow the application to access an element by index 2) Put each RemoteStore monad in a different thread and communicate to it over STM.
It seems that monadic sequencing is not strictly necessary to model the remote store functions. It could be accomplished with a
withConnection
function, and that would make it much easier to write the application that I described. I'm open to other suggestions. Perhaps there's an alternative I haven't thought of.