Reputation: 195
| Log (message, ack) ->
let CreateEventSourcingConnection() =
task {
let connection =
let ipEndPoint = IPEndPoint(IPAddress.Loopback, 1113)
EventStoreConnection.Create(ipEndlPoint)
do! connection.ConnectAsync()
return connection
}
let AddEventToStreamAsync (connection: IEventStoreConnection) streamName eventName message =
task {
let serializedEventData =
message
|> JsonConvert.SerializeObject
|> Encoding.UTF8.GetBytes
let event = EventData(Guid.NewGuid(), eventName, true, serializedEventData, null)
let! _ = connection.AppendToStreamAsync(streamName, int64 ExpectedVersion.Any, event)
()
}
Error:
The block following this 'let' is unfinished. Every code block is an expression and must have a result. 'let' cannot be the final code element in a block. Consider giving this block an explicit result.
I have tried calling these functions after defining them. I have also checked my indentation, I think it should be okay. I understand I need to return the value from the function, but I think I already do that.
Upvotes: 1
Views: 141
Reputation: 3029
I suspect (without knowing which let
statement is causing the error) that you need to be returning something from the pattern match (i.e. the part that comes after | Log (message, ack) ->
).
If you don't need to return anything, you can just return ()
at the end, at the same level of indentation as the two outer let
s, but note that all branches of the pattern matching need to return the same type.
Upvotes: 2