Skip to content
Sourceable

sourceable

[ >!: ]

The sourceable protocol defines how a value should produce a lazy sequence of values.

This differs from the seqable protocol in that sources are not guaranteed to produce the same values in the same order every time. They may also modify some state in the source itself (such as mutating the offset of a file descriptor).

The lines between the two protocols are somewhat blurred, as the gab\channel type does implement the seqable protocol using the sourceable protocol, like so:

  [Channels.t] .defmodule {
    seq\init: _ :: do
      (ok, xs*) := self >!
      (ok, nil:, xs*)
    end
    seq\next: _ :: do
      (ok, xs*) := self >!
      (ok, nil:, xs*)
    end
  }