Hi,
 
I'm using utop version 1.19.3 (using OCaml version 4.03.0).
 
Using an named record in a type definition and afterwards match on multiple constructors works:
# type a = {i:int};;
#type t = A of a | B of a;;
# let x = A {i=10};;
# match x with
| A e | B e -> print_int e.i;;
 
 
Using an unnamed record in a type definition and afterwards match on multiple constructors does not work:
# type t = A of {i:int} | B of {i:int};;
# let x = A {i=10};;
# match x with
| A e | B e -> print_int e.i;;

"Error: The variable e on the left-hand side of this or-pattern has type t.A but on the right-hand side it has type t.B"
 
 
 
I don't know if this is behaviour of OCaml is desired or it's a fault.
 
Hope I could help you with this little hint.
 
Best regards,
 
Gabriel


FreeMail powered by mail.de - mehr Sicherheit, Seriosität und Komfort