在purescript中,具有循环依赖关系的记录可以声明如下
newtype User = User
{ name :: String
, organization :: Organization
}
newtype Organization = Organization
{ name :: String
, users :: List User
}
但我还没弄清楚如何在purescript中实际创建实例。在F#中,可以按如下方式创建实例。
let rec pam = { name = "Pamela"; organization = fed }
and jill = { name = "Jillian"; organization = fed }
and fed = { name = "Federal Reserve"; users = [pam;jill] }
我总是得到pam的值是未定义的。也许使用修复功能?
答案 0 :(得分:0)
我不认为可以在PureScript中执行此操作而不会使结构的某些部分变得懒惰:
calculateDistanceToFinalSnap