fsharp / fsharp/fslang-suggestions
Catch improper use of monadic return in async
- Dominant language
- No language data
- Stars
- 373
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
**Submitted by William Blum on 10/17/2015 12:00:00 AM**
**11 votes on UserVoice prior to migration**
The following code should issue a type checking error since `return ()` should yield an `Async` and return 42 should yield an `Async`.
``` fsharp
let f c =
async {
return ()
printfn "You passed %A and I am returning 42" c
return 42
}
```
Additionally the following code should issue a warning since the return statement does not actually affect the flow of execution as the name suggests (The printf statement is actually executed).
``` fsharp
let g c =
async {
return ()
printfn "You passed %A and I am returning 42" c
return ()
}
```
**[Original UserVoice Submission](https://fslang.uservoice.com/forums/245727-f-language/suggestions/10256475)**
[Archived Uservoice Comments](../tree/master/archive/suggestion-10256475-catch-improper-use-of-monadic-return-in-async.md#comments)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the two async examples in the issue and review the archived UserVoice comments for prior discussion. Determine the intended type-checking error for mixed return types and the warning for unreachable-looking returns; done means both diagnostics are produced consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100