-
Notifications
You must be signed in to change notification settings - Fork 59
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
Presence of return is misleading #38
Comments
Yes, IIRC this is an F# language limitation where it is problematic to express that a method takes a single parameter of type |
@dsyme I've tried a patched version of compiler and could successfully remove the As stated in the initial comment, the call
to be processed without the need for Should I create a PR with the compiler change in visualfsharp for further discussion? |
Hi @maxx We wouldn't change Return to Zero - that would be a breaking change. We might however remove the limitation that Return gets called with both However even that change might not meeting our no-breaking-change policy, and we might have to resort to just emitting a warning of some kind. |
I think my concern is not clear. In the current Don, you are right about the breaking change if we simply replace the |
That approach looks good! Please add an fslang.uservoice.com entry for it - I'll mark it as approved for some future release - and submit the PR to Microsoft/visualfsharp. It will take a long while before libraries like AsyncSeq can rely on this language change though, since it basically currently targets FSharp.Core 4.3.0.0 and supports use by F# 3.0+ |
@dsyme It's very weird, actually the distinguishing problem only arises from the usage of signature file. |
@mexx following up on this, is there still some action to take on this library or has focused shifted elsewhere? |
The next version of F# compiler will allow to use |
I'll try do an updated summary because i got same issue ( #92 ), it's really error prone :D more so migrating from v1 to v2 So the compiler feature from @mexx was released in F# 4.1 NOTE
Q: Can be useful to do it just for
I think the CONS1 is instead a nice to have. any code like this let a = asyncSeq {
yield 1
return 2 // this compile, but 2 is ignored, so a bug without error
} will need to be changed to let a = asyncSeq {
yield 1
} who does the same thing. |
I was extremely confused by this as well. My use case was yielding a single value in the sequence given an The adjustment to the compiler is nice, since I ran into that |
I tried to create a pull request for the above, but encountered a problem with specifying the signature in the fsi file. The compiler required me to define the Return method as |
This issue confused two of my teammates again last week (we're a team of only 6, so that really hurts). I've submitted a PR with my best effort to fix this issue. |
As a workaround to stop the pain now, I've added this to our project to define a version of the CE builder without the Return:
|
So if I understand correctly we should just remove the |
Given the following expression
asyncSeq { return [1] }
.I would expect the type of it to be
AsyncSeq<int>
, unfortunately it isAsyncSeq<'a>
.I understand that in first place it's my wrong expectation about the
result
's presence, actually as it's a sequential workflow, it shouldn't be there at all.By looking at the source code I know that the presence of
return
is caused by the wish to support thedo! action
functionality, as it's translated by the F# compiler intoBind(action, fun () -> Return())
.Could it be a F# compiler problem? What if the compiler would transform it to
Bind(action, Zero())
, then theresult
return
could be dropped right?05.12.2015: corrected identifier
The text was updated successfully, but these errors were encountered: