caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Damien Guichard" <alphablock@orange.fr>
To: "Liste de diffusion OCaml" <caml-list@inria.fr>
Subject: Variants & structural ordering
Date: Tue, 5 Feb 2008 09:21:21 +0100	[thread overview]
Message-ID: <20080205081845.2D24D1C02531@mwinf2341.orange.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]


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

[-- Attachment #2: Type: text/html, Size: 1238 bytes --]

             reply	other threads:[~2008-02-05  8:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-05  8:21 Damien Guichard [this message]
2008-02-05  9:47 ` [Caml-list] " Berke Durak
2008-02-05  9:48 ` Oliver Bandel
2008-02-05 15:04 ` Jon Harrop
2008-02-06  8:21 ` Michaël Grünewald
2008-02-07 15:50 ` Damien Doligez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080205081845.2D24D1C02531@mwinf2341.orange.fr \
    --to=alphablock@orange.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).