Browse thread
Variants & structural ordering
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jon Harrop <jon@f...> |
| Subject: | Re: [Caml-list] Variants & structural ordering |
On Tuesday 05 February 2008 08:21:21 Damien Guichard wrote: > 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#. Comparison is OCaml's achilles heel and this is one (minor) manifestation of that. The ability to develop a program and break a use of polymorphic comparison buried within it without knowing is far more serious and has caused many people untold grief in the past. SML's equality types are a slight improvement but F# and Haskell's solutions are the best way forward AFAICT. OCaml will never be fixed in this sense but, hopefully, a next-generation FPL implementation will solve these problems without sacrificing OCaml's other benefits. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e