【发布时间】:2020-03-30 03:49:41
【问题描述】:
| 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)
()
}
()
//Do something with the `message` value specific to the target
//you are creating.
//Don't put `use` statements in here; you need to dispose them before
//recursing below.
//This is a simple acknowledgement using unit as the signal
ack *<= () (* LHS: the ACK is a unit sent to `ack` *) >>= fun () ->
(* RHS (above): the callback after the ACK is done *)
loop { state = not state.state } // recurse
错误在这一行
ack *<= () (* LHS: the ACK is a unit sent to `ack` *) >>= fun () ->
错误:FS0010 表达式中有意外的标识符。预计此时或之前的不完整结构化构造或其他标记。
【问题讨论】:
-
最后一行
loop是否应该与前一行具有相同的缩进级别? -
不,这是原始github.com/logary/logary/blob/master/src/Logary/Targets/Noop.fs 的缩进。这个问题只有在我添加我的功能后才会出现。我也不能在这里调用这些函数。
-
不,很遗憾:(
-
在 cmets 上方的
()是什么?看起来这是原始模式匹配案例的返回值,所以后面应该没有任何内容。
标签: f#