Skip to content

LanguageExt Aff and Eff support in Processes

Latest
Compare
Choose a tag to compare
@louthy louthy released this 01 Mar 16:26
· 7 commits to main since this release
590473e

The previous attempt at a deep integration of language-ext Eff and Aff support in echo processes didn't work out (as discussed here).

So, I have done a much simpler implementation:

  • That requires no changes to the core actor-system that runs the echo-processes, and so is risk-free for all existing code
  • Enables asynchronous processes for the first time
  • Facilitates injectable IO operations (via Eff and Aff)

To leverage it you should use Process<RT> rather than Process as your starting point. There's:

  • Process<RT>.* - the core prelude functions
  • Process<RT>.spawn* functions for creating proceses that take Eff and Aff computations
  • Process<RT>.tell* for telling messages to other processes
  • Process<RT>.ask* for request/response to other processes
  • Process<RT>.reply* for replies to other processes
  • Process<RT>.register* for registering named processes

Because this is a more 'lightweight' approach, the Process<RT> functions are simply wrappers to the existing Process functions. That means you don't get to build a DI runtime for Echo itself (even though there is a placeholder trait called HasEcho<RT>).

I think this is fine as a starting point though, because mostly everything that echo does is managed in-memory and is relatively easy to mock. The main value-add here is that all IO within a process can be mocked, which makes it relatively trivial to build unit-tests for an inbox function.

If you don't care about Eff or Aff then this release will have no impact on you. If you want to know more then check out the write-up on the language-ext repo.