Browse thread
strange behavior with record type definition
[
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: | Florent <florentflament@a...> |
| Subject: | strange behavior with record type definition |
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
#