From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA23284 for caml-redistribution; Mon, 25 Oct 1999 17:40:24 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA03861 for ; Fri, 22 Oct 1999 16:01:42 +0200 (MET DST) Received: from maxime.u-strasbg.fr (maxime.u-strasbg.fr [130.79.75.36]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id QAA28581 for ; Fri, 22 Oct 1999 16:01:39 +0200 (MET DST) Received: (from luther@localhost) by maxime.u-strasbg.fr (8.8.7/8.8.7) id QAA27215 for caml-list@inria.fr; Fri, 22 Oct 1999 16:03:04 +0200 (MET DST) Message-ID: <19991022160304.A27175@maxime.u-strasbg.fr> Date: Fri, 22 Oct 1999 16:03:04 +0200 From: Sven LUTHER To: caml-list@inria.fr Subject: module, module type et foncteurs, ... Reply-To: luther@dpt-info.u-strasbg.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2 Sender: weis Bonjour, ... Je souhaite ecrire quelque chose du genre : ----------------------------------------------------------- module A = struct type a = A | B | C let id (x : a) = x end module type T_A = sig type a val id : a -> a end module type T_A_detail = sig type a = A | B | C end module type T_A_choisi = T_A module type T_B = sig type a type b = | TA of A.a | TB of b end module type T_Make_B = functor (A : T_A_choisi) -> T_B module Make_B (A : T_A_choisi) = struct type a = A.a type b = | TA of A.a | TB of b end module Make_C (A : T_A_detail) (Make_B : T_Make_B) = struct let string_of_a = function | A.A -> "A" | A.B -> "B" | A.C -> "C" end module B2 = Make_B (A) module C2 = Make_C (A) (Make_B) let rec string_of_b = function | B2.TA a -> B2.string_of_a a | B2.TB b -> string_of_b b ----------------------------------------------------------- Mais j'obtient l'erreur suivante : ----------------------------------------------------------- File "exemple.ml", line 35, characters 24-30: Signature mismatch: Modules do not match: functor(A : T_A_choisi) -> sig type a = A.a and b = Make_B(A).b = | TA of A.a | TB of b end is not included in T_Make_B Modules do not match: sig type a = A.a and b = Make_B(A).b = | TA of A.a | TB of b end is not included in T_B Type declarations do not match: type b = Make_B(A).b = | TA of A.a | TB of b is not included in type b = | TA of A.a | TB of b ----------------------------------------------------------- Est-ce normal, que ce passe-t-il exactement. Y a-t-il une autre maniere de faire la meme chose ? Je ne comprend pas qu'elle est la difference entre type b = Make_B(A).b = | TA of A.a | TB of b et type b = | TA of A.a | TB of b D'un autre cote est-ce qu'un type de tableau de booleens qui serait represente de maniere efficace existe ? on aurrait un bit par booleen, et non un int comme cela est fait actuellement. J'imagine qu'on peut faire cela en definissant un type de tableau d'entier, et aller voir la valeur de chaque bit de ces entiers. Amicalement, Sven LUTHER