gpt4 book ai didi

f# - 从 F# 类型提供程序提供可区分联合

转载 作者:行者123 更新时间:2023-12-04 02:29:35 26 4
gpt4 key购买 nike

我已经掌握了类型提供程序的基础知识,例如创建类型

let thisAssembly = Assembly.GetExecutingAssembly()
let t = ProvidedTypeDefinition(
thisAssembly,namespaceName,
xType.Attribute(xname "name").Value,
baseType = Some typeof<obj>)

但我需要能够定义记录类型和 DU 类型,类型提供者有什么方法可以做到这一点吗?

最佳答案

不幸的是,无法在类型提供程序中定义任何 F# 特定类型,如 Discriminated Unions、Records 或 Modules,只能定义类和命名空间,这有点不幸

关于f# - 从 F# 类型提供程序提供可区分联合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21564179/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com