Types 在内部使用列表时,不定义相互递归类型
我在编译一个旧的F#项目时遇到了问题。有问题的文件是 它使用相互递归类型,并且正确定义了缩进。但是,无论是Types 在内部使用列表时,不定义相互递归类型,types,f#,recursive-type,Types,F#,Recursive Type,我在编译一个旧的F#项目时遇到了问题。有问题的文件是 它使用相互递归类型,并且正确定义了缩进。但是,无论是EDNValue还是EDNValue-parsed都是在相同的上下文/缩进级别上看到的 module EDNParserTypes = type EDNException(message : string) = inherit System.Exception(message) type QualifiedSymbol = struct val pr
EDNValue
还是EDNValue-parsed
都是在相同的上下文/缩进级别上看到的
module EDNParserTypes =
type EDNException(message : string) =
inherit System.Exception(message)
type QualifiedSymbol =
struct
val prefix: string
val name: string
new (prefix, name) = {prefix = prefix; name = name}
override this.ToString() = "QualifiedSymbol Prefix: " + this.prefix + " Name: " + this.name
end
type EDNValue = EDNNil
| EDNBoolean of bool
| EDNString of string
| EDNCharacter of char
| EDNSymbol of QualifiedSymbol
| EDNKeyword of QualifiedSymbol
| EDNInteger of BigInteger
| EDNFloat of double
| EDNComment of string
| EDNDiscard of EDNValueParsed
| EDNTaggedValue of QualifiedSymbol * EDNValueParsed
| EDNList of string list
| EDNVector of string array
| EDNMap of List<string>
| EDNSet of List<string>
and EDNValueParsed =
struct
val line: int64
val col: int64
val ednValue: EDNValue
new (ednValue, line, col) = { ednValue = ednValue; line = line; col = col }
override this.ToString() =
sprintf "%A" this.ednValue
end
奇怪的是,如果我删除类型的lists部分定义,它不会失败(但显然在需要这些定义的其他地方失败)
移除此零件后,将正确定义类型:
| EDNList of string list
| EDNVector of string array
| EDNMap of List<string>
| EDNSet of List<string>
|字符串列表的EDNList
|字符串数组的变换器
|列表的EDNMap
|列表的EDNSet
我遗漏了什么?如果您有新版本的VS,您就不能有旧的“预装”版本的FSharp.Core(
4.0.0
)
所以,参考如下:
<Reference Include="FSharp.Core, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
将会是一个破碎的世界
我无法重现问题中的错误,但我得到的错误非常简单:
无法解析此链接。找不到程序集“FSharp.Core,版本=4.0.0.0,区域性=中性,PublicKeyToken=b03f5f7f11d50a3a,processorArchitecture=MSIL”
类型“FSharpList”是在未引用的程序集中定义的。您必须添加对程序集“FSharp.Core,Version=4.3.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”的引用
更正后,项目生成不会出现错误。它可以正常生成me@FoggyFinder您使用的VS版本是什么?VS 2017,上次更新如果,我忘了在构建之前我将
FSharp.Core
包的版本更改为4.3.0.0
。好吧,这就成功了。谢谢
<Reference Include="FSharp.Core, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />