Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Chris King <colanderman@g...>
Subject: Re: [Caml-list] How to expose sum type constructors to an interface
On 10/17/07, Felix Dorner <felix_do@web.de> 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
(http://tech.groups.yahoo.com/group/ocaml_beginners/) for future
"beginner" questions :)

> 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?

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.

HTH,
Chris