caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hongbo Zhang <bobzhang1988@gmail.com>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] Ask for help on compiler's module Typing.types
Date: Wed, 25 Jul 2012 07:45:40 -0400	[thread overview]
Message-ID: <500FDC64.8020301@gmail.com> (raw)

Hi List,
    I was doing some code generation based on type information.

    The following code snippet was what I tried in the toplevel:
    match Env.lookup_value (Longident.Lident "f") !Toploop.toplevel_env with
    | (_, { Types.val_type = val_type }) ->
     Printtyp.type_expr std_formatter val_type

    As we see, we can query "f" , get its type information and pretty 
print it, and then parse it
    again to get the type information.

    Actually, we can process Types.val_type directly in a more robust 
way, but I found
    the type definitions in typing/types.ml was quite verbose and 
without any comment. I understand
    it generally but not in a precise way.

    Would anyone shed some light on the internal design of typing 
directory? English or
    French are both welcome.

Thanks in advance!
-Hongbo

                 reply	other threads:[~2012-07-25 11:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=500FDC64.8020301@gmail.com \
    --to=bobzhang1988@gmail.com \
    --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).