From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 4DF60BB84 for ; Sun, 14 May 2006 14:22:13 +0200 (CEST) Received: from rouge.crans.org (rouge.crans.org [138.231.136.3]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k4ECMC79018444 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sun, 14 May 2006 14:22:12 +0200 Received: from localhost (rouge.adm.crans.org [138.231.144.3]) by rouge.crans.org (Postfix) with ESMTP id DF301BBCC; Sun, 14 May 2006 14:22:09 +0200 (CEST) Received: from rouge.crans.org ([138.231.144.3]) by localhost (rouge [138.231.144.3]) (amavisd-new, port 10024) with LMTP id 10995-01-7; Sun, 14 May 2006 14:22:09 +0200 (CEST) Received: from [128.31.34.250] (31-34-250.wireless.csail.mit.edu [128.31.34.250]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by rouge.crans.org (Postfix) with ESMTP id 8293ABBBC; Sun, 14 May 2006 14:22:09 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: DooMeeR Content-Transfer-Encoding: 7bit From: Charles Bouillaguet Subject: Recursive Variant problem.. Date: Sun, 14 May 2006 08:22:09 -0400 To: caml-list@yquem.inria.fr X-Mailer: Apple Mail (2.749.3) X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at crans.org X-Miltered: at concorde with ID 446720F4.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; recursive:01 arrays:01 arrays:01 variants:01 recursive:01 romain:01 romain:01 wrote:01 polymorphic:01 caml-list:01 define:01 int:01 int:01 modules:01 variant:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Hello Caml-List, I would like to write a type which describe some kind of term in a toy programming language. It has sets, but not sets of sets type 'a array_ = [`Array of 'a] type base_sort = [`Int | `Float | `Object | `Array of base_sort] (* arrays of arrays are OK *) type sort = [base_sort | `Set of base_sort] (* sets of sets are NOT OK*) The problem appear when I want to define my values : type 'sort array_state = 'sort * [`ArrayStateVar of string | `ArrayWrite of 'me * 'sort base_value * [`Int] base_value * 'sort base_value] as 'me and 'sort base_value = 'sort * [`Inert of unit | `FieldRead of [`Object] base_value * 'sort field | `ArrayRead of 'sort array_state * ('sort array_) base_value * [`Int] base_value] and 'sort field = 'sort * [`FieldVar of string | `FieldWrite of 'me * [`Object] base_value * 'sort base_value] as 'me is refused with error : ========================= In the definition of base_value, type [ `Int ] array_state should be 'a array_state ====================== I then have two questions : a) is it possible to write that with polymorphic variants, and how ? b) Is it possible to wrote that with Recursive modules, and how ? I'm CC-ing my classmate Romain (Hi, Romain !), as he may be interested... Charles Bouillaguet -=-=-=-=- Ens de Cachan, Currently visiting MIT.