using CanonSharp.Combinator.Abstractions; namespace CanonSharp.Combinator.Extensions; public static class ReadStateExtensions { public static IEnumerable AsEnumerable(this TState source) where TState : IReadState { TState current = source; while (current.HasValue) { yield return current; current = current.Next; } } }