caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Ask for help on compiler's module Typing.types
@ 2012-07-25 11:45 Hongbo Zhang
  0 siblings, 0 replies; only message in thread
From: Hongbo Zhang @ 2012-07-25 11:45 UTC (permalink / raw)
  To: Caml List

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-25 11:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-25 11:45 [Caml-list] Ask for help on compiler's module Typing.types Hongbo Zhang

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).