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

the return of asyncSeq builder is non intuitive #92

Closed
enricosada opened this issue Aug 27, 2018 · 2 comments
Closed

the return of asyncSeq builder is non intuitive #92

enricosada opened this issue Aug 27, 2018 · 2 comments

Comments

@enricosada
Copy link
Contributor

enricosada commented Aug 27, 2018

The return of the asyncSeq computation ignore the value passed.
I found it bug prone when upgrading a library from asyncseq v1 to v2 types.

let a = asyncSeq {
    yield 1
    yield 2
    return 3
}
  • no errors
  • the a is AsyncSeq<int>
  • as list, it's [1; 2]
  • the 3 is ignored, no warning, no errors

Same when trying to return another asyncSeq like

let b = asyncSeq {
   yield 4
   return a
}

i think that should be return! a to work correctly (not yet supported)

workaround

always do yield and yield!

let a = asyncSeq {
    yield 1
    yield 2
    yield 3
}

let b = asyncSeq {
   yield 4
   yield! b
}
@eulerfx
Copy link
Contributor

eulerfx commented Aug 27, 2018

Related: #38

@enricosada
Copy link
Contributor Author

@eulerfx I missed that. Closing this because is a duplicate.

Continuing discussion in other thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants