Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以使用该类型之前的类型和签名中的类型来专门化签名中的类型吗?这是一个例子:
signature A = sig type t type s end
我可以专攻A以下吗?
A
signature B = A where type s = t list
SML/NJ 和 Mlton 都抱怨不受约束t。
t
不,这确实不能直接完成。原因是相当技术性的,在一般情况下,为这样的操作赋予良好的语义并不容易。
最接近的方法是引入另一种辅助类型:
signature B = sig type t' include A with type t = t' with type s = t' list end