caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pietro Abate <Pietro.Abate@anu.edu.au>
To: ocaml ml <caml-list@inria.fr>
Subject: type_declaration in env.ml
Date: Fri, 15 Jun 2007 22:41:19 +1000	[thread overview]
Message-ID: <20070615124119.GD20124@pulp.rsise.anu.edu.au> (raw)

hi all,
I'm trying to understand this data structure in env.ml in the ocaml src
files.

type type_declaration =
  { type_params: type_expr list;
    type_arity: int;
    type_kind: type_kind;
    type_manifest: type_expr option;
    type_variance: (bool * bool * bool) list }

and type_kind =
    Type_abstract
  | Type_variant of (string * type_expr list) list * private_flag
  | Type_record of (string * mutable_flag * type_expr) list
                 * record_representation * private_flag


If I've a type  like :
type t = A of int | B of float

I'll get 

type_params = []
type_arity = 0 
type_kind = Type_variant ( 
                [ "A", [ { desc = Tvar ; level = ?? ; id = ?? }] ;
                  "B", [ { desc = Tvar ; level = ?? ; id = ?? }] ] , false )
type_manifest = ??
type_variance = []

correct ?
what if I have just
type t = int ?
where I store the type identifier "t" in both cases ?

Can anybody explain me the semantic of these fields ? I can guess some, 
but I'm not very confident...

thanks.

pietro

-- 
++ Blog: http://blog.rsise.anu.edu.au/?q=pietro
++ 
++ "All great truths begin as blasphemies." -George Bernard Shaw
++ Please avoid sending me Word or PowerPoint attachments.
   See http://www.fsf.org/philosophy/no-word-attachments.html


             reply	other threads:[~2007-06-15 12:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-15 12:41 Pietro Abate [this message]
2007-06-15 14:39 ` [Caml-list] " Xavier Leroy

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=20070615124119.GD20124@pulp.rsise.anu.edu.au \
    --to=pietro.abate@anu.edu.au \
    --cc=caml-list@inria.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).