(************************************************************ opaque_manifest.sml ************************************************************) structure X = struct type t = int val x = (1:t) (* val (x:t) = 1 でもよい *) end;; signature XS = sig type t; val x : t; end;; structure XOpaque = X :> XS;; structure XManifest = X : XS;; val opaque_value = XOpaque.x;; val manifest_value = XManifest.x;; (** 実行結果 harp:~>sml - use "opaque_manifest.sml";; [opening opaque_manifest.sml] structure X : sig type t = int val x : t end signature XS = sig type t val x : t end structure XOpaque : XS structure XManifest : XS val opaque_value = - : XOpaque.t val manifest_value = 1 : X.t val it = () : unit - opaque_value;; val it = - : XOpaque.t (* 抽象型 *) - manifest_value;; val it = 1 : X.t (* Coreのintと互換性のある型 *) **)