'Background task with result leads to compiler error FS0073
I am new to F# language but as far as I read backgroundTask syntax isn't limited to being only tasks with no result, however, when I change the following code I get compiler error FS0073
Severity Code Description Project File Line Suppression State Error FS0073 internal error: Undefined or unsolved type variable: 'a
let sendSerializedPayload (writePayload, commandType: BaseCommand.Type) =
Log.Logger.LogDebug("{0} Sending message of type {1}", prefix, commandType)
backgroundTask { // <-- this used to be just task
try
do! connection.Output |> writePayload
return true
with ex ->
Log.Logger.LogWarning(ex, "{0} Socket was disconnected exceptionally on writing {1}", prefix, commandType)
post operationsMb ChannelInactive
return false
}
Is there something that I am doing wrong or not understanding or there is a compiler problem with backgroundTasks with results (I don't get such errors when switching from task to backgroundTask for task that does not have result?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
