2008-10-27から1日間の記事一覧

Private abbreviation type

3.11 で導入された、Private abbreviation type を使って自然数を実装してみましょう: module M : sig type nat = private int val nat_of_int : int -> nat val int_of_nat : nat -> int end = struct type nat = int let nat_of_int n = (assert (n >= 0))…