Browse thread
Weird behavior with mutually recursive type definitions
[
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: | Jacques GARRIGUE <garrigue@k...> |
| Subject: | Re: More confusion with mutually recursive type definitions |
> OK, so I understand the following error message:
>
> # type 'a t = 'a and u = int t and v = bool t;;
> This type bool should be an instance of type int
>
> But then, why is the following declaration accepted?
>
> # type 'a t = 'a and u = A of int t and v = B of bool t;;
> type 'a t = 'a
> type u = | A of int t
> type v = | B of bool t
>
> I am still confused...
And ought to be... this is a bug:
Objective Caml version 2.02
# type 'a t = 'a constraint 'a = int and u = A of int t and v = B of bool t;;
Uncaught exception: Ctype.Unify(_)
Is it already corrected ?
Jacques
---------------------------------------------------------------------------
Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac.jp
<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>