From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 88368BC57 for ; Tue, 3 Aug 2010 08:57:40 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkUCAF9aV0zRVdY2mGdsb2JhbACgAQgVAQEBAQEICQwHESKoD4kEghCGPS6IVAEBAwWFNASIf4JKhSA X-IronPort-AV: E=Sophos;i="4.55,308,1278280800"; d="scan'208";a="55042099" Received: from mail-bw0-f54.google.com ([209.85.214.54]) by mail3-smtp-sop.national.inria.fr with ESMTP; 03 Aug 2010 08:57:40 +0200 Received: by bwz12 with SMTP id 12so2723744bwz.27 for ; Mon, 02 Aug 2010 23:57:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:sender:received :in-reply-to:references:from:date:x-google-sender-auth:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=thjc+ay0nfJvfv0I/TEaipJJWxuz0aIUAlIiXAcwAAE=; b=u92zsG9A/s+GCMSmijzy17PDLhP+PWBOG1SA580sA/AXWW4yJ+dIPcov1fiIEONSGT 8BchLYJBJySZ7gYTtzWB4bwapfD3hxjKnk9A9V7SNNl2ijK1Q3Rb0bNyrvXL6XCFNo46 iPOJsuyaQ8+HrB4t6USmK9qrmaFk+pEod1hkU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=ioNQtIjyCmfnur0ELTSmVVsCuxvMGrx0DQi3lOXL7eFarbptKxhqQ9Trr/Ujx6Blk4 Ovimd/SzyTGX0XP6kVQRdWnRl1mQ/VHfKI20PBv53OUDYFXt0eh5xkWoqtD4MXfNPNp3 4yWMVpEpAfLAjAMVFw+Fqk/Y21azNypmzE3lo= Received: by 10.204.82.167 with SMTP id b39mr4862887bkl.164.1280818659635; Mon, 02 Aug 2010 23:57:39 -0700 (PDT) MIME-Version: 1.0 Sender: gabriel.scherer@gmail.com Received: by 10.204.22.82 with HTTP; Mon, 2 Aug 2010 23:57:19 -0700 (PDT) In-Reply-To: References: From: bluestorm Date: Tue, 3 Aug 2010 08:57:19 +0200 X-Google-Sender-Auth: jCfxLx2PYWBC7ZV8wXuWOq_VjCk Message-ID: Subject: Re: [Caml-list] Conditionals based on phantom types To: Joseph Young Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; conditionals:01 ocaml:01 sig:01 val:01 val:01 wrote:01 abstract:01 abstract:01 caml-list:01 module:03 module:03 float:03 float:03 unit:03 let:03 On Tue, Aug 3, 2010 at 8:15 AM, Joseph Young wrote: > module Units : sig > =A0 =A0type t > =A0 =A0val to_feet : float -> [`Feet]*t > =A0 =A0val to_meters : float -> [`Meters]*t > [..] > end With this type, the value representation of units is not abstract anymore (and it is not very useful to have still t abstract). The user can analyse the values you give him and access the unit member. This is the difference with the ('a t) representation were the relation between 'a and values is hidden outside the module. For example, your user can write something like that, wich could be indesirable : let convert [ `Feet ] * Units.t -> [ `Meters ] * Units.t =3D function (`Feet, t) -> (`Meters, t)