caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Charles Bouillaguet <Charles.Bouillaguet@crans.org>
To: caml-list@yquem.inria.fr
Cc: DooMeeR <romain.bardou@wanadoo.fr>
Subject: Recursive Variant problem..
Date: Sun, 14 May 2006 08:22:09 -0400	[thread overview]
Message-ID: <A4840FB4-9473-4B6C-8BB3-B10D7AA72B76@crans.org> (raw)

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.


             reply	other threads:[~2006-05-14 12:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-14 12:22 Charles Bouillaguet [this message]
2006-05-15  8:09 ` [Caml-list] " Stephane Glondu
2006-05-15 11:23 ` Jacques Garrigue
2006-05-15 12:40   ` Jacques Garrigue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A4840FB4-9473-4B6C-8BB3-B10D7AA72B76@crans.org \
    --to=charles.bouillaguet@crans.org \
    --cc=caml-list@yquem.inria.fr \
    --cc=romain.bardou@wanadoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).