Version française
Home     About     Download     Resources     Contact us    
Browse thread
(int * int) <> int*int ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Frédéric_Gava <gava@u...>
Subject: (int * int) <> int*int ?
Hi,

is anybody can semantically explain why this 2 types are differents ?

# type t=A of int*int and  t'= B of (int*int);;
type t = A of int * int
and t' = B of (int * int)

# A (2,3);;
- : t = A (2, 3)
# B (2,3);;
- : t' = B (2, 3)

# let a=2,3;;
val a : int * int = (2, 3)

# (A a);;
The constructor A expects 2 argument(s), but is here applied to 1
argument(s)
# (B a);;
- : t' = B (2, 3)

I understand that it'is force you to have a pair for A and not just a value
of type pair but why this restriction ? It is not easy to explain why
int*int <> (int*int).

Thanks !
Frédéric Gava