我希望实现一个stackwith value restriction。
我想要的是popandpush总是在谈论完全相同的类型。
这是我的sig。
module type MyStackSig =
sig
type 'a stack
exception EmptyStack
val create : unit -> 'a stack
val push : 'a stack -> 'a -> unit
val pop : 'a stack -> 'a
val is_empty : 'a stack -> bool
val size : 'a stack -> int
end;;
这个签名够value restriction吗?
我的意思是会push一直pop在谈论同一种类型吗?