stack
withを実装したいと思いvalue restriction
ます。
私が欲しいのは、pop
とpush
が常にまったく同じタイプについて話しているということです。
これが私の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