caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Modules
@ 2003-05-09 19:45 Christophe Poucet
  2003-05-09 19:58 ` David Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Christophe Poucet @ 2003-05-09 19:45 UTC (permalink / raw)
  To: CAML

[-- Attachment #1: Type: text/plain, Size: 600 bytes --]

Hello,
I hope you don't mind another question from me (still trying my best to learn Ocaml).
I have made a module signature (an .mli) file and module implementation (an .ml) file.

They look sort of like this:
(* TigerSymbol.mli file *)
module type TIGERSYMBOL = 
sig
...
end

(* TigerSymbol.ml file *)
module TigerSymbol : TIGERSYMBOL =
struct
...
end

When I compile as follows:
ocamlc -c TigerSymbol.mli
ocamlc -c TigerSymbol.ml
it complains on the second compile that: Unbound module type TIGERSYMBOL

Any clues why this is so?
Thanking you in advance,
Christophe Poucet

[-- Attachment #2: Type: text/html, Size: 1868 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Modules
  2003-05-09 19:45 [Caml-list] Modules Christophe Poucet
@ 2003-05-09 19:58 ` David Brown
  0 siblings, 0 replies; 6+ messages in thread
From: David Brown @ 2003-05-09 19:58 UTC (permalink / raw)
  To: Christophe Poucet; +Cc: CAML

On Fri, May 09, 2003 at 09:45:32PM +0200, Christophe Poucet wrote:

> They look sort of like this:
> (* TigerSymbol.mli file *)
> module type TIGERSYMBOL = 
> sig
> ...
> end
> 
> (* TigerSymbol.ml file *)
> module TigerSymbol : TIGERSYMBOL =
> struct
> ...
> end

The construct you specified above is _implicitly_ wrapped around the
contents of these files.  The files themselves should just contain the
parts given by ...

Also, the filename for TigerSymbol will need to be 'tigerSymbol.mli' and
'tigerSymbol.ml'.  The first letter needs to be made lowercase.

Hope that helps.

Dave Brown

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Modules
  2009-11-10  8:39   ` blue storm
@ 2009-11-10 12:25     ` Wouter Swierstra
  0 siblings, 0 replies; 6+ messages in thread
From: Wouter Swierstra @ 2009-11-10 12:25 UTC (permalink / raw)
  To: Pierre-Evariste Dagand, blue storm; +Cc: caml-list

Thanks for pointing out these links. They're all very helpful. Best,

  Wouter


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Modules
  2009-11-10  8:31 ` [Caml-list] Modules Pierre-Evariste Dagand
@ 2009-11-10  8:39   ` blue storm
  2009-11-10 12:25     ` Wouter Swierstra
  0 siblings, 1 reply; 6+ messages in thread
From: blue storm @ 2009-11-10  8:39 UTC (permalink / raw)
  To: Pierre-Evariste Dagand; +Cc: Wouter Swierstra, caml-list

I'd also add :
- the "formal" part of the manual (Part II) description of module
types : http://caml.inria.fr/pub/docs/manual-ocaml/manual018.html . In
particular the "Type specifications" section is quite informative
imho.
- the module-related chapter of the "UUU book" :
http://caml.inria.fr/pub/docs/u3-ocaml/ocaml-modules.html

If you're interested in theory, you can find an introduction to the ML
Module system theory in the Pierce's book "Advanced topic in Types and
Programming Languages" [1], and a some more advanced papers in the "A
Few Paper On Caml" section of this website :
http://caml.inria.fr/about/papers.en.html

[1] http://books.google.com/books?id=A5ic1MPTvVsC&pg=PA293&dq=pierce+module+ML#v=onepage&q=pierce%20module%20ML&f=false

On Tue, Nov 10, 2009 at 9:31 AM, Pierre-Evariste Dagand
<pedagand@gmail.com> wrote:
> Hi Wouter,
>
>> While I'm familiar with functional programming, I am occasionally puzzled by
>> errors relating to the module system.
>
> That's normal, everyone does, at some point. Especially when you start
> having Parameterized Modules (called Functors in ML) all over the
> place.
>
>> I was wondering if there was a
>> comprehensive overview/tutorial of OCaml's module system.
>
> For a comprehensive source of information, there is the OCaml manual:
>
> http://caml.inria.fr/pub/docs/manual-ocaml/manual004.html
>
> For a tutorial on modules, I would recommend Chapter 14 of "Developing
> Applications With Objective Caml":
>
> http://caml.inria.fr/pub/docs/oreilly-book/html/index.html
>
>
> Hope this helps,
>
>
> --
> Pierre-Evariste DAGAND
> http://perso.eleves.bretagne.ens-cachan.fr/~dagand/
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Modules
  2009-11-10  8:13 Modules Wouter Swierstra
@ 2009-11-10  8:31 ` Pierre-Evariste Dagand
  2009-11-10  8:39   ` blue storm
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre-Evariste Dagand @ 2009-11-10  8:31 UTC (permalink / raw)
  To: Wouter Swierstra; +Cc: caml-list

Hi Wouter,

> While I'm familiar with functional programming, I am occasionally puzzled by
> errors relating to the module system.

That's normal, everyone does, at some point. Especially when you start
having Parameterized Modules (called Functors in ML) all over the
place.

> I was wondering if there was a
> comprehensive overview/tutorial of OCaml's module system.

For a comprehensive source of information, there is the OCaml manual:

http://caml.inria.fr/pub/docs/manual-ocaml/manual004.html

For a tutorial on modules, I would recommend Chapter 14 of "Developing
Applications With Objective Caml":

http://caml.inria.fr/pub/docs/oreilly-book/html/index.html


Hope this helps,


-- 
Pierre-Evariste DAGAND
http://perso.eleves.bretagne.ens-cachan.fr/~dagand/


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] modules
  2006-01-31  9:33 modules Brendan Miller
@ 2006-01-31  9:43 ` Yann Coscoy
  0 siblings, 0 replies; 6+ messages in thread
From: Yann Coscoy @ 2006-01-31  9:43 UTC (permalink / raw)
  To: caml-list

Brendan Miller a écrit :
> can a single module be made in several files? for example, if I had
> several classes or submodules and wanted to put one in each .ml file
> to make it more manageable.

  You should have a look to option '-pack' of ocamlc and ocmlopt.

   Yann Coscoy


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-11-10 12:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-09 19:45 [Caml-list] Modules Christophe Poucet
2003-05-09 19:58 ` David Brown
2006-01-31  9:33 modules Brendan Miller
2006-01-31  9:43 ` [Caml-list] modules Yann Coscoy
2009-11-10  8:13 Modules Wouter Swierstra
2009-11-10  8:31 ` [Caml-list] Modules Pierre-Evariste Dagand
2009-11-10  8:39   ` blue storm
2009-11-10 12:25     ` Wouter Swierstra

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