Loading ...
Sorry, an error occurred while loading the content.

Re: "ocaml_beginners"::[] unbound module type

Expand Messages
  • Fabrice Marchant
    Hi justin, ... Please do you have a link to intrange ? Fabrice
    Message 1 of 3 , Jul 1, 2007
    • 0 Attachment
      Hi justin,

      > I am working though some example code from ocaml for scientists.

      Please do you have a link to "intrange" ?

      Fabrice
    • justin_henzie
      Hi all, I am working though some example code from ocaml for scientists. I have an mli and accompanying ml file which I am compiling thus: ocamlc -c
      Message 2 of 3 , Jul 1, 2007
      • 0 Attachment
        Hi all,

        I am working though some example code from ocaml for scientists.


        I have an mli and accompanying ml file which I am compiling thus:

        ocamlc -c intrange.mli
        ocamlc -c intrange.ml

        When compiling the ml file I receive the following error:

        * File "intrange.ml", line 1, characters 18-26:
        * Unbound module type INTRANGE

        Both files and the resulting cmi file, from the mli, are in the same
        directory.

        I have been using ocaml for a while but have just started using
        modules and have to admit, in a somewhat embarrassed tone, that this
        has me stumped.

        Any suggestions?

        -jh
      • Jon Harrop
        ... Sounds like you ve started the intrange.ml file with module IntRange : INTRANGE = struct ... which is unnecessary (the compilation unit intrange.ml
        Message 3 of 3 , Jul 1, 2007
        • 0 Attachment
          On Sunday 01 July 2007 17:48:02 justin_henzie wrote:
          > Hi all,
          >
          > I am working though some example code from ocaml for scientists.
          >
          >
          > I have an mli and accompanying ml file which I am compiling thus:
          >
          > ocamlc -c intrange.mli
          > ocamlc -c intrange.ml
          >
          > When compiling the ml file I receive the following error:
          >
          > * File "intrange.ml", line 1, characters 18-26:
          > * Unbound module type INTRANGE
          >
          > Both files and the resulting cmi file, from the mli, are in the same
          > directory.
          >
          > I have been using ocaml for a while but have just started using
          > modules and have to admit, in a somewhat embarrassed tone, that this
          > has me stumped.
          >
          > Any suggestions?

          Sounds like you've started the intrange.ml file with

          module IntRange : INTRANGE = struct
          ...

          which is unnecessary (the compilation unit intrange.ml implicitly defined a
          module called Intrange that has the interface given in intrange.mli). So you
          can remove this code when using separate compilation.

          The downside is that you can't refer to the module type defined by the .mli
          because it is anonymous.

          --
          Dr Jon D Harrop, Flying Frog Consultancy Ltd.
          The OCaml Journal
          http://www.ffconsultancy.com/products/ocaml_journal/?e
        Your message has been successfully submitted and would be delivered to recipients shortly.