From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id B6F28BC0A for ; Thu, 15 Mar 2007 16:38:35 +0100 (CET) Received: from smtp.uibk.ac.at (lmr1.uibk.ac.at [138.232.1.142]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2FFcYaR003290 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 15 Mar 2007 16:38:35 +0100 Received: from smc.uibk.ac.at (smc.uibk.ac.at [138.232.1.226] c703350@smc.uibk.ac.at) by smtp.uibk.ac.at (8.13.8/8.13.1/F1) with ESMTP id l2FFcYVU027369 for ; Thu, 15 Mar 2007 16:38:34 +0100 Received: from smc.uibk.ac.at (localhost [127.0.0.1] c703350@smc.uibk.ac.at) by smc.uibk.ac.at (8.13.8+Sun/uibk) with ESMTP id l2FFcXIi003823 for ; Thu, 15 Mar 2007 16:38:33 +0100 (MET) Received: (from c703350@localhost) by smc.uibk.ac.at (8.13.8+Sun/8.13.8/Submit) id l2FFcXaU003816 for caml-list@yquem.inria.fr; Thu, 15 Mar 2007 16:38:33 +0100 (MET) Date: Thu, 15 Mar 2007 16:38:33 +0100 From: Christian Sternagel To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] module types and constraints in several layers Message-ID: <20070315153833.GE3236@pc6197-c703.uibk.ac.at> Mail-Followup-To: caml-list@yquem.inria.fr References: <20070315101236.GB3236@pc6197-c703.uibk.ac.at> <875c7e070703150625r2fe44739r86755099a2bd2594@mail.gmail.com> <20070315142142.GD3236@pc6197-c703.uibk.ac.at> <875c7e070703150748j74bd6bc2nb79150d4e095ab84@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <875c7e070703150748j74bd6bc2nb79150d4e095ab84@mail.gmail.com> User-Agent: Mutt/1.4.2.2i X-Scanned-By: MIMEDefang 2.58 at uibk.ac.at on 138.232.1.140 X-Miltered: at concorde with ID 45F9687A.004 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; struct:01 sig:01 val:01 o'caml:01 syntax:01 cheers:01 beginner's:01 ocaml:01 bug:01 beginners:01 wrote:01 wrote:01 caml-list:01 caml-list:01 constraint:01 On Thu, Mar 15, 2007 at 09:48:44AM -0500, Chris King wrote: > On 3/15/07, Christian Sternagel 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 >