skuld_concurrency

Coroutine > | Umbrella →

Cooperative concurrency for the Skuld effect system — coroutines, a fiber pool scheduler, streaming, and process bridging. Everything runs in-process with structured concurrency; no GenServers, no supervision trees, no message-passing overhead.

What's included

Installation

def deps do
[
{:skuld_concurrency, "~> 0.32"}
]
end

Example: concurrent stream processing

use Skuld.Syntax
alias Skuld.Effects.{Yield, Channel, Brook, FiberPool}
# A stream of work items
source = 1..100 |> Enum.map(&"item-#{&1}")
comp do
results <-
Brook.from_enum(source)
|> Brook.map(fn item ->
comp do
# Simulate async work on each item
Yield.yield(item)
end
end, concurrency: 8)
|> Brook.to_list()
results
end
|> Yield.with_handler()
|> Channel.with_handler()
|> FiberPool.with_handler()
|> Comp.run!()
# 8 concurrent fibers, Channel provides backpressure, FiberPool schedules them all

Further reading

See the architecture guide for how this fits into the Skuld ecosystem.


Coroutine > | Umbrella →