From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 47502BC6C for ; Thu, 31 Jan 2008 20:13:15 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAAOtoUfAXQImh2dsb2JhbACQHwEBAQgKKZha X-IronPort-AV: E=Sophos;i="4.25,286,1199660400"; d="scan'208";a="8586057" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 31 Jan 2008 20:13:14 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m0VJDEJg015134 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 31 Jan 2008 20:13:14 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAABesoUdA6aq+n2dsb2JhbACQHwEBAQEBBgQGCQgYmF0 X-IronPort-AV: E=Sophos;i="4.25,286,1199660400"; d="scan'208";a="7485807" Received: from rn-out-0910.google.com ([64.233.170.190]) by mail1-smtp-roc.national.inria.fr with ESMTP; 31 Jan 2008 20:13:13 +0100 Received: by rn-out-0910.google.com with SMTP id e24so369215rng.6 for ; Thu, 31 Jan 2008 11:13:12 -0800 (PST) Received: by 10.142.157.15 with SMTP id f15mr1489622wfe.22.1201806791251; Thu, 31 Jan 2008 11:13:11 -0800 (PST) Received: by 10.142.173.18 with HTTP; Thu, 31 Jan 2008 11:13:11 -0800 (PST) Message-ID: <3a360f590801311113o4db1d660s206e7af4bcb3226@mail.gmail.com> Date: Thu, 31 Jan 2008 14:13:11 -0500 From: "Hezekiah M. Carty" Sender: hcarty@mulethief.com To: "Romain Bardou" Subject: Re: [Caml-list] Attach an invariant to a type Cc: caml-list In-Reply-To: <47A20FC1.5040103@lri.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <47a1cd167921b@wp.pl> <47A1D212.3010205@lri.fr> <1201802294.6154.56.camel@Blefuscu> <47A20FC1.5040103@lri.fr> X-Google-Sender-Auth: fb390ecef940d25e X-Miltered: at discorde with ID 47A21DCA.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lri:01 sig:01 val:01 struct:01 wrote:01 assert:01 caml-list:01 int:01 int:01 variant:02 module:03 let:03 types:05 types:05 manual:06 On Jan 31, 2008 1:13 PM, Romain Bardou wrote: > Wow, how could I forget about private types. > > However, you still need the of_int function. > > module Subindex: sig > type t = private int > val make: int -> t > end = struct > type t = int > let make n = > assert (n >= 10 && x <= 100); > n > end > This code does not work for me. I get a "This fixed type is not an object or variant" error on the "type t = private int" line. From the manual it looks like you would have to use something like this: type t = private Index of int to take advantage of private types. Am I missing something? Hez