package parseff

  1. Overview
  2. Docs

Module Parseff.SourceSource

Input sources for incremental parsing. A source wraps a readable byte stream — a channel, file descriptor, or custom reader — behind a uniform interface. The parser pulls data on demand through the effect handler; existing parser code works unchanged.

Sourcetype t
Sourceval of_string : string -> t

of_string s creates a source from a complete string. Useful for testing streaming code paths with known input.

Sourceval of_channel : ?buf_size:int -> in_channel -> t

of_channel ?buf_size ic creates a source that reads from ic. buf_size controls the internal read buffer (default 4096).

Sourceval of_function : (bytes -> int -> int -> int) -> t

of_function read creates a source that calls read buf off len to obtain up to len bytes starting at offset off in buf. Must return the number of bytes actually read; return 0 to signal EOF.