caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <xavier.leroy@inria.fr>
To: efiliot@ens-lyon.fr
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] module type and record
Date: Mon, 16 Jun 2003 17:08:01 +0200	[thread overview]
Message-ID: <20030616170801.B9308@pauillac.inria.fr> (raw)
In-Reply-To: <1055757571.3eed95032132f@mouette.ens-lyon.fr>; from efiliot@ens-lyon.fr on Mon, Jun 16, 2003 at 11:59:31AM +0200

> hello,
> I need to declare a record type in a field like :
> 
> module A : ( MY_TYPE with type t = { label1 : int ; label2 : string } ) =
> struct
> ....
> end
> 
> but the compiler seems to refuse this declaration.

Currently, only type abbreviations can be added with the "with type"
construct:  MODTYPE with type t = some_type_expression.

This restriction is somewhat artificial and I'm considering lifting it.

> Could you give me a solution for this problem ?

Currently, you need to expand "MY_TYPE with..." by hand into

        sig
          type t = { label1 : int ; label2 : string }
          (* other elements of signature MY_TYPE
        end

An alternative is to declare the record type separately:

        type my_rec = { label1 : int ; label2 : string }

        module A : (MY_TYPE with type t = my_rec) = ...

- Xavier Leroy

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


      reply	other threads:[~2003-06-16 15:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <65D56CA3-9FDA-11D7-813D-000A95764898@ens-lyon.fr>
2003-06-16  9:59 ` efiliot
2003-06-16 15:08   ` Xavier Leroy [this message]

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=20030616170801.B9308@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=efiliot@ens-lyon.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).