From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p4ANiUMY003265 for ; Wed, 11 May 2011 01:44:31 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMCAO3MyU1KfVO2kGdsb2JhbACmBAgUAQEBAQkJDQcUBCGIcKFnjkuFG4kVAQEDBoYJBIZAiS6EJ4ERhTw7gSWCHA X-IronPort-AV: E=Sophos;i="4.64,348,1301868000"; d="scan'208";a="94864275" Received: from mail-pv0-f182.google.com ([74.125.83.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 11 May 2011 01:44:23 +0200 Received: by pvg11 with SMTP id 11so4784774pvg.27 for ; Tue, 10 May 2011 16:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer; bh=CAGS1BKOjx235NoMOIbDOn7vWY2KAZpkB1gnb7dwBws=; b=J9pwwbUf6y/JADp26vavqS9BUgmQErpguIXF00LY023eExvYCHwkDLlp3fVeU2ZDCu 5ySZw6bMZkqoX7WkwpRG0t2to/5nCK2BbA/4zhhkyaZUz298RF9SdBuJnV1ww4OE+ZWT 5I48TJwKppBQA1dLNXODCQMWgyivtO3aQ5Acg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=nZackLbzbVnkhOzH99GN1OjPrSl3QyEitlPdX94o0qlzb2yUiDI+LdL4UfHmtTFvhl II9PysTf4uBjVTOPlP8w3wsetYmtSaZv+ZL4QxHc747wnMhbXWKyDqdYJRUep3WNtoUU XjYe0hjmfhxMo3AoUsQemT1qwIHGqnnlchnY0= Received: by 10.68.43.234 with SMTP id z10mr2569537pbl.300.1305071062019; Tue, 10 May 2011 16:44:22 -0700 (PDT) Received: from [10.2.33.68] (O-TK-MSC52000001.w-lan.jp [143.90.238.110]) by mx.google.com with ESMTPS id p17sm5114569pbt.83.2011.05.10.16.44.16 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 May 2011 16:44:20 -0700 (PDT) Sender: Jacques Garrigue Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Jacques Garrigue In-Reply-To: <719085.83949.qm@web111512.mail.gq1.yahoo.com> Date: Wed, 11 May 2011 08:44:06 +0900 Cc: caml-list@inria.fr Message-Id: <35C81D78-50FE-47D2-93E2-F48FF4AEED3F@math.nagoya-u.ac.jp> References: <719085.83949.qm@web111512.mail.gq1.yahoo.com> To: Dario Teixeira X-Mailer: Apple Mail (2.1084) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p4ANiUMY003265 Subject: Re: [Caml-list] Difference between [ `A ] and [< `A ] On 2011/05/11, at 1:46, Dario Teixeira wrote: > Hi, > > I've seen OCaml code "in the wild" where both of the following signatures > are present: (the type parameter for 't' is a phantom type) > > val foo: [< `A ] t -> unit > val bar: [ `A ] t -> unit > > But is there any practical difference between [ `A ] and [< `A ] given > that there is only one element in the set? In this particular case the two types are almost equivalent. The only counterexample I could find is unifying with the following private row type: type leA = private [< `A] leA is unifiable with [< `A] but not with [`A]. The difference becomes more significant when there is an argument. For instance, [< `A of int] and [< `A of bool] are unifiable, giving [< `A of int & bool], but [`A of int] cannot be unified with [`A of bool]. Note that some old versions of OCaml did some "singleton promotion", i.e. [< `A of int] was automatically converted to [`A of int]. This was removed as an unnecessary complication, and also because you might actually want to distinguish the two for private row types. Jacques Garrigue