计算表达凹痕混乱
我显然不了解计算表达中的缩进(我通常是地图/绑定的人)。
此代码编译
seq {
for concept in model.EsWondomainmodelconcepts do
let attLookup = seq {
for att in concept.Attributes.EsWondomainmodelattributes do
for tag in (att.XmlTag |> Option.toArray) do
for mult in (att.Multiplicity.EspEnumeration.Identificationdisplaystring.String |> Option.toArray) do
(tag,multiplicityToRelationshipCardinality mult)
}
(concept.XmlTag, attLookup |> Map.ofSeq)
}
|> Map.ofSeq
|> WOnSchemaRawData
这并不是
seq {
for concept in model.EsWondomainmodelconcepts do
let attLookup = seq { // FS3118 on this line
for att in concept.Attributes.EsWondomainmodelattributes do
for tag in (att.XmlTag |> Option.toArray) do
for mult in (att.Multiplicity.EspEnumeration.Identificationdisplaystring.String |> Option.toArray) do
(tag,multiplicityToRelationshipCardinality mult)
} |> Map.ofSeq // FS0588 here
(concept.XmlTag, attLookup)
}
|> Map.ofSeq
|> WOnSchemaRawData
“让attlookup = ....” comply
Severity Code Description Project File Line Suppression State
Error FS3118 Incomplete value or function definition. If this is in an expression, the body of the expression must be indented to the same column as the 'let' keyword.
和1st“ |> map.ofseq”行clock offe
Severity Code Description Project File Line Suppression State
Error FS0588 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 clearly don't understand indentation in computational expression (I'm usually a map/bind sort of person).
This code compiles
seq {
for concept in model.EsWondomainmodelconcepts do
let attLookup = seq {
for att in concept.Attributes.EsWondomainmodelattributes do
for tag in (att.XmlTag |> Option.toArray) do
for mult in (att.Multiplicity.EspEnumeration.Identificationdisplaystring.String |> Option.toArray) do
(tag,multiplicityToRelationshipCardinality mult)
}
(concept.XmlTag, attLookup |> Map.ofSeq)
}
|> Map.ofSeq
|> WOnSchemaRawData
this doesnt
seq {
for concept in model.EsWondomainmodelconcepts do
let attLookup = seq { // FS3118 on this line
for att in concept.Attributes.EsWondomainmodelattributes do
for tag in (att.XmlTag |> Option.toArray) do
for mult in (att.Multiplicity.EspEnumeration.Identificationdisplaystring.String |> Option.toArray) do
(tag,multiplicityToRelationshipCardinality mult)
} |> Map.ofSeq // FS0588 here
(concept.XmlTag, attLookup)
}
|> Map.ofSeq
|> WOnSchemaRawData
the line "let attLookup = ...." complains
Severity Code Description Project File Line Suppression State
Error FS3118 Incomplete value or function definition. If this is in an expression, the body of the expression must be indented to the same column as the 'let' keyword.
and the 1st "|> Map.ofSeq" complains
Severity Code Description Project File Line Suppression State
Error FS0588 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信我理解这一点而无需与编译器尝试。我将说明一些简单的代码段所发生的事情。
允许这样做:
但是这是不允许的,这对我来说很有意义,为什么不允许:
这对我也很有意义:
所以我怀疑您可以像最后一段一样格式化代码,这将是好的。
I believe I understand this without trying it out with a compiler. I will illustrate what I think happens with some simpler code snippets.
This is allowed:
But this is not allowed, and it makes sense to me why not:
This is allowed, which also makes sense to me:
So I suspect you can format the code as in the last snippet, and it'll be good.