Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v5] One item lag in StreamT when used with Source #1387

Open
louthy opened this issue Oct 20, 2024 · 0 comments
Open

[v5] One item lag in StreamT when used with Source #1387

louthy opened this issue Oct 20, 2024 · 0 comments
Assignees
Labels
bug v5 Related to version 5.0.0+

Comments

@louthy
Copy link
Owner

louthy commented Oct 20, 2024

The new Source<A> type yields a StreamT when .Await<IO>() is called.

Posting a value to the Source (with Post) doesn't immediately yield a value downstream. It seems to yield when a subsequent item is posted.

static StreamT<IO, Unit> show(Source<string> source) =>
    from v in source.Await<IO>()
    from _ in writeLine(v)
    where false
    select unit;

It seems the item makes it all the way to the M.Pure(MList<A>.Cons(iter.Current, next(iter))); in Lift(IEnumerable) but no value yields.

I suspect that the IO monad doesn't evaluate until subsequent binds/combines, which means we need another item to come thru to get the first one.

Debugging this was an absolute sh!t which is turning my head inside out. So logging this for now so I can come back to it fresh.

The test case is Streams sample "0. Source stream"

@louthy louthy added the bug label Oct 20, 2024
@louthy louthy self-assigned this Oct 20, 2024
@louthy louthy added the v5 Related to version 5.0.0+ label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug v5 Related to version 5.0.0+
Projects
None yet
Development

No branches or pull requests

1 participant