Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
How to expose sum type constructors to an interface
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-10-18 (00:41)
From: Chris King <colanderman@g...>
Subject: Re: [Caml-list] How to expose sum type constructors to an interface
On 10/17/07, Felix Dorner <> wrote:
> although this might really be a beginner´ s question I´ ll post it here
> and risk to be eaten by the big fish around here...

Well, this small fish is going to nudge you in the direction of the
O'Caml beginners list
( for future
"beginner" questions :)

> In my implementation file 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?

Just add "type aType = A | B" to the module.mli file.  As a side note,
if you ever want to see what the inferred signature (i.e. the
signature of a .ml with no .mli) of a module is, run ocaml -i on the
.ml file and it will spit the inferred .mli to standard output.