caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christian Sternagel <christian.sternagel@uibk.ac.at>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] module types and constraints in several layers
Date: Thu, 15 Mar 2007 16:38:33 +0100	[thread overview]
Message-ID: <20070315153833.GE3236@pc6197-c703.uibk.ac.at> (raw)
In-Reply-To: <875c7e070703150748j74bd6bc2nb79150d4e095ab84@mail.gmail.com>

On Thu, Mar 15, 2007 at 09:48:44AM -0500, Chris King wrote:
> On 3/15/07, Christian Sternagel <christian.sternagel@uibk.ac.at> wrote:
> >some.ml:
> >module Make (Trs : TRS.T) : SOME.T = struct
> 
> This looks to be your problem... by specifying the type of Trs as
> TRS.T, you are losing the information about the relation between the
> types in the modules.  You can fix this by adding this relation to the
> definition of TRS.T:
> 
> module type T = sig
> type t
> module Term: TERM.T
> module Fun : FUNCTION.T with type t = Term.Fun.t
> val f0 : t -> Fun.t Setx.set
> end
> 
> Otherwise O'Caml presumes Term and Fun to be completely unrelated.
> 
> Hope this helps; module type constraints can get messy :)
Thanks this helped a lot... no the only open problem is how
to constrain variant types.

i have 
module type TERM
 module Var : VAR
 module Fun : FUN
 module Lab : LAB
  with type t = Fun.Lab.t

 type t = Var of Var.t | Fun of Fun.t * t list
end

and in the module type  TRS I need to do something like

module type TRS
 module Rule : RULE
 module Term : TERM
  with module Var = Rule.Var
  and module Fun = Rule.Fun
  and module Lab = Rule.Lab
  and type t = Rule.Term.t
               ^^^^^^^^^^^

which yields a syntax error... is there a way to give such a 
constraint for variant types?

cheers

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


      reply	other threads:[~2007-03-15 15:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-15 10:12 Christian Sternagel
2007-03-15 13:25 ` [Caml-list] " Chris King
2007-03-15 14:21   ` Christian Sternagel
2007-03-15 14:48     ` Chris King
2007-03-15 15:38       ` Christian Sternagel [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=20070315153833.GE3236@pc6197-c703.uibk.ac.at \
    --to=christian.sternagel@uibk.ac.at \
    --cc=caml-list@yquem.inria.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).