caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Variants & structural ordering
@ 2008-02-05  8:21 Damien Guichard
  2008-02-05  9:47 ` [Caml-list] " Berke Durak
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Damien Guichard @ 2008-02-05  8:21 UTC (permalink / raw)
  To: Liste de diffusion OCaml

[-- 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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-02-07 15:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-05  8:21 Variants & structural ordering Damien Guichard
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

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).