taffy/native
Native YAML parsing backend wrapping the fast_yaml C NIF (libyaml).
Erlang target only — requires fast_yaml in your dependencies.
Output is the same YamlValue shape as the pure-Gleam parser but
~3-7× faster on large documents.
import taffy/native
let assert Ok(value) = native.parse("name: John\nage: 30")
One known divergence from the pure parser: fast_yaml represents both
{} and [] as the empty Erlang list at the term level, so the
distinction can’t be recovered from the decoded value alone. Taffy
resolves the ambiguity in favour of Mapping([]) since {} is the
more common author intent; users who need Sequence([]) for []
should use the pure parser.
Values
pub fn parse(
input: String,
) -> Result(value.YamlValue, taffy.Error)
Parse a single document via fast_yaml. The error type matches the
pure parser’s so callers can swap backends without changing their
error-handling. pos is always 0 here — fast_yaml doesn’t expose a
position on its error path.
pub fn parse_all(
input: String,
) -> Result(List(value.YamlValue), taffy.Error)
Parse a multi-document stream via fast_yaml. Same error semantics
as parse.