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=1.9 required=5.0 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST,HTML_MESSAGE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id C6097BC6C for ; Tue, 5 Feb 2008 09:18:59 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAEuqp0fAXQInh2dsb2JhbACCPTONRAEBAQgKKZwB X-IronPort-AV: E=Sophos;i="4.25,306,1199660400"; d="scan'208,217";a="6896648" Received: from concorde.inria.fr ([192.93.2.39]) by mail2-smtp-roc.national.inria.fr with ESMTP; 05 Feb 2008 09:18:59 +0100 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m158Iw2j020859 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 5 Feb 2008 09:18:59 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAIaqp0fB/BYelmdsb2JhbACCPTONRAEBAQEHBAYHChEHnAI X-IronPort-AV: E=Sophos;i="4.25,306,1199660400"; d="scan'208,217";a="22196219" Received: from smtp23.orange.fr ([193.252.22.30]) by mail4-smtp-sop.national.inria.fr with ESMTP; 05 Feb 2008 09:18:58 +0100 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2341.orange.fr (SMTP Server) with ESMTP id 3560E1C02544 for ; Tue, 5 Feb 2008 09:18:58 +0100 (CET) Received: from Thinkpad-R60 (Mix-Lyon-303-2-225.w193-248.abo.wanadoo.fr [193.248.44.225]) by mwinf2341.orange.fr (SMTP Server) with SMTP id 2D24D1C02531 for ; Tue, 5 Feb 2008 09:18:45 +0100 (CET) X-ME-UUID: 20080205081845185.2D24D1C02531@mwinf2341.orange.fr Date: Tue, 5 Feb 2008 09:21:21 +0100 From: "Damien Guichard" To: "Liste de diffusion OCaml" Subject: Variants & structural ordering X-mailer: Foxmail 5.0 [-fr-] Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=====003_Dragon688863810154_=====" Message-Id: <20080205081845.2D24D1C02531@mwinf2341.orange.fr> X-Miltered: at concorde with ID 47A81BF2.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; damien:01 guichard:01 variants:01 ocaml:01 work-around:01 bug:01 damien:01 ocaml:01 work-around:01 bug:01 int:01 int:01 unit:03 unit:03 structural:04 This is a multi-part message in MIME format. --=====003_Dragon688863810154_===== Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi everybody, Typically, when you declare: type card = | Card of int | Jack | Queen | King | Ace ;; The relation you wish is: Card(2) < ...< Card(10) < Jack < Queen < King < Ace And that's what you get when using F#. However when using OCaml here is what you get: Jack < Queen < King < Ace < Card(2) < ...< Card(10) And the work-around is: type card = | Card of int | Jack of unit | Queen of unit | King of unit | Ace of unit ;; Is this a bug or a feature ? Will it change in a foreseable future ? - damien --=====003_Dragon688863810154_===== Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit

Hi everybody,
 
Typically, when you declare:
 
type card =
  | Card of int
  | Jack
  | Queen
  | King
  | Ace
  ;;
 
The relation you wish is:
 
Card(2) < ...< Card(10) < Jack < Queen < King < Ace
 
And that's what you get when using F#.
 
However when using OCaml here is what you get:
 
Jack < Queen < King < Ace < Card(2) < ...< Card(10)
 
And the work-around is:
 
type card =
  | Card of int
  | Jack of unit
  | Queen of unit
  | King of unit
  | Ace of unit
  ;;
 
Is this a bug or a feature ?
Will it change in a foreseable future ?
 
- damien
--=====003_Dragon688863810154_=====--