caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Julien Moutinho <julien.moutinho@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] How to expose sum type constructors to an interface
Date: Thu, 18 Oct 2007 02:45:06 +0200	[thread overview]
Message-ID: <20071018004506.GA17963@localhost> (raw)
In-Reply-To: <4716A5F2.9090708@web.de>

On Thu, Oct 18, 2007 at 02:16:50AM +0200, Felix Dorner wrote:
> In my implementation file module.ml I define: type aType = A | B
> How I now need to expose this Type and its constructors to the interface  
> module.mli, because some of the functions declared in the interface take a 
> parameter of type "aType". How can I do this?

The toplevel or the flag
  -i  Print inferred interface
may help you :)

% cat file.ml
type a_type = A | B

let f =
    function
    | A -> B
    | _ -> A
% ocamlc -i file.ml
type a_type = A | B
val f : a_type -> a_type

A few pointers that may help too:
http://caml.inria.fr/pub/docs/oreilly-book/html/book-ora130.html#toc180
http://caml.inria.fr/pub/docs/manual-ocaml/manual018.html#@manual.kwd135


  parent reply	other threads:[~2007-10-18  0:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-18  0:16 Felix Dorner
2007-10-18  0:41 ` [Caml-list] " Chris King
2007-10-18  0:45 ` Julien Moutinho [this message]
2007-10-18  5:48   ` Christophe Raffalli

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=20071018004506.GA17963@localhost \
    --to=julien.moutinho@gmail.com \
    --cc=caml-list@yquem.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).