caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* strange behavior with record type definition
@ 2005-11-11 22:59 Florent
  2005-11-11 23:52 ` [Caml-list] " Jon Harrop
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Florent @ 2005-11-11 22:59 UTC (permalink / raw)
  To: caml-list

Hi, I have defined two distinct record's types with a field's name in 
common. But when I try to define a function that uses the first of the 
types, the compiler gives me a type error.
How can I use my first type in a function ??

This is what I did:

# type t0 = { i : int ; s : string };;
type t0 = { i : int; s : string; }
# type t1 = { i : int ; f : float };;
type t1 = { i : int; f : float; }
# let f (x:t0) = match x with {i= a; s= b} -> b;;
Characters 28-40:
  let f (x:t0) = match x with {i= a; s= b} -> b;;
                              ^^^^^^^^^^^^
The record field label s belongs to the type t0
but is here mixed with labels of type t1
#



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

end of thread, other threads:[~2005-11-13 12:47 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-11 22:59 strange behavior with record type definition Florent
2005-11-11 23:52 ` [Caml-list] " Jon Harrop
2005-11-12  0:15 ` Michael Wohlwend
2005-11-12  0:20 ` Martin Jambon
2005-11-12 10:58   ` Florent
2005-11-12 12:12     ` skaller
2005-11-12 12:20       ` Nicolas Cannasse
2005-11-12 12:51         ` skaller
2005-11-12 14:15           ` Michael Wohlwend
2005-11-12 14:45             ` skaller
2005-11-12 15:26             ` Christophe TROESTLER
2005-11-12 14:23           ` Florent
2005-11-12 15:32             ` Christophe TROESTLER
2005-11-12 16:50             ` Florian Weimer
2005-11-13  0:12             ` Jacques Garrigue
2005-11-13 12:50               ` Florent

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