Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
F# 错误:FS0010表达式中存在意外标识符。在此点或其他标记处或之前应为不完整的结构化构造 |日志(消息,确认)-> 让CreateEventSourcingConnection()= 任务{ 让连接= 让ipEndPoint=ipEndPoint(IPAddress.Loopback,1113) EventStoreConnection.Create(ipEndlPoint) do!connection.ConnectAsync() 回路连接 } 让AddEventToStreamAsync(连接:IEventStoreConnection)streamName事件名称消息= 任务{ 让我们序列化deventdata= 消息 |>JsonConvert.SerializeObject |>Encoding.UTF8.GetBytes let event=EventData(Guid.NewGuid(),eventName,true,serializedEventData,null) let!\ux=connection.AppendToStreamAsync(streamName,int64 ExpectedVersion.Any,事件) () } () //使用特定于目标的'message'值执行某些操作 //你正在创造。 //不要在这里放“use”语句;你需要先把它们处理掉 //在下面递归。 //这是一个使用单元作为信号的简单确认 ack*>=fun()-> (*RHS(上图):确认完成后的回调*) 循环{state=notstate.state}//递归_F# - Fatal编程技术网

F# 错误:FS0010表达式中存在意外标识符。在此点或其他标记处或之前应为不完整的结构化构造 |日志(消息,确认)-> 让CreateEventSourcingConnection()= 任务{ 让连接= 让ipEndPoint=ipEndPoint(IPAddress.Loopback,1113) EventStoreConnection.Create(ipEndlPoint) do!connection.ConnectAsync() 回路连接 } 让AddEventToStreamAsync(连接:IEventStoreConnection)streamName事件名称消息= 任务{ 让我们序列化deventdata= 消息 |>JsonConvert.SerializeObject |>Encoding.UTF8.GetBytes let event=EventData(Guid.NewGuid(),eventName,true,serializedEventData,null) let!\ux=connection.AppendToStreamAsync(streamName,int64 ExpectedVersion.Any,事件) () } () //使用特定于目标的'message'值执行某些操作 //你正在创造。 //不要在这里放“use”语句;你需要先把它们处理掉 //在下面递归。 //这是一个使用单元作为信号的简单确认 ack*>=fun()-> (*RHS(上图):确认完成后的回调*) 循环{state=notstate.state}//递归

F# 错误:FS0010表达式中存在意外标识符。在此点或其他标记处或之前应为不完整的结构化构造 |日志(消息,确认)-> 让CreateEventSourcingConnection()= 任务{ 让连接= 让ipEndPoint=ipEndPoint(IPAddress.Loopback,1113) EventStoreConnection.Create(ipEndlPoint) do!connection.ConnectAsync() 回路连接 } 让AddEventToStreamAsync(连接:IEventStoreConnection)streamName事件名称消息= 任务{ 让我们序列化deventdata= 消息 |>JsonConvert.SerializeObject |>Encoding.UTF8.GetBytes let event=EventData(Guid.NewGuid(),eventName,true,serializedEventData,null) let!\ux=connection.AppendToStreamAsync(streamName,int64 ExpectedVersion.Any,事件) () } () //使用特定于目标的'message'值执行某些操作 //你正在创造。 //不要在这里放“use”语句;你需要先把它们处理掉 //在下面递归。 //这是一个使用单元作为信号的简单确认 ack*>=fun()-> (*RHS(上图):确认完成后的回调*) 循环{state=notstate.state}//递归,f#,F#,这行有错误 | Log (message, ack) -> let CreateEventSourcingConnection() = task { let connection = let ipEndPoint = IPEndPoint(IPAddress.Loopback, 1113) EventStoreConnection.Create(ipEndlPoint

这行有错误

| 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*>=fun()->

错误:FS0010表达式中存在意外标识符。在该点或其他标记处或之前应为不完整的结构化构造。

我尝试从中获取代码并粘贴更改,以替换与
日志
大小写匹配的模式匹配大小写

由于代码中的缩进问题,我得到了与您报告的相同的错误。特别是,
ack*=fun()->
(*RHS(上图):确认完成后的回调*)
循环{state=notstate.state}//递归

最后一行
循环
是否应该与前一行具有相同的缩进级别?否,这是原始行的缩进级别。此问题仅在我添加函数后出现。我也不能在这里调用这些函数。这能回答你的问题吗?不,不幸的是:(注释上方的
()
是做什么的?看起来这是原始模式匹配案例的返回值,所以后面不应该有任何内容。Diky moc.:)如果您也能看看我的其他F#问题,我将不胜感激。
ack *<= () (* LHS: the ACK is a unit sent to `ack` *) >>= fun () ->
  let CreateEventSourcingConnection() =
      task {
          return connection
      }

  let AddEventToStreamAsync (connection: IEventStoreConnection) streamName eventName message =
      task {
          ()
      }
  ()
  //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