Accueil     À propos     Téléchargement     Ressources     Contactez-nous

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

[Caml-list] Camlp4 3.01 released
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
 Date: 2001-03-12 (15:58) From: Christophe Raffalli Subject: [Caml-list] Caml 3.01 : pb with include
```
I tried to use the new include feature for my algebra library. I failed
!
Am I missing something ?

Here is a small example I created just to show the problem:

module type Semi_Group =
sig
type t
val e : t
val ( ** ) : t -> t -> t
end

module type Group =
sig
include Semi_Group
val inv : t -> t
end

module type Semi_Group_Morphism =
sig
module SG1 : Semi_Group
module SG2 : Semi_Group
val f : SG1.t -> SG2.t
end

module type Group_Morphism =
sig
module G1 : Group
module G2 : Group
include Semi_Group_Morphism with module SG1 = G1 and module SG2 = G2
end

(*
Nice : SG1 et SG2 are groups : Here isCaml answer

module type Group_Morphism =
sig
module G1 : Group
module G2 : Group
module SG1 :
sig
type t = G1.t
val e : t
val ( ** ) : t -> t -> t
val inv : t -> t
end
module SG2 :
sig
type t = G2.t
val e : t
val ( ** ) : t -> t -> t
val inv : t -> t
end
val f : SG1.t -> SG2.t

end
*)

module Idt_Semi_Group_Morphism(SG : Semi_Group) = (
struct
module SG1 = SG
module SG2 = SG
let f = fun x -> x
end : Semi_Group_Morphism with module SG1 = SG and module SG2 = SG)

module Idt_Group_Morphism(G : Group) = (
struct
module G1 = G
module G2 = G
include (Idt_Semi_Group_Morphism(G) : Semi_Group_Morphism with module
SG1 = G and module SG2 = G)
end : Group_Morphism with module SG1 = G and module SG2 = G and module
G1 = G and module G2 = G)

(*
Heavy and does not work !

Signature mismatch:
Modules do not match:
sig
module SG1 : sig type t = G.t val e : t val ( ** ) : t -> t -> t end
module SG2 : sig type t = G.t val e : t val ( ** ) : t -> t -> t end
val f : SG1.t -> SG2.t
end
is not included in
sig
module SG1 :
sig
type t = G.t
val e : t
val ( ** ) : t -> t -> t
val inv : t -> t
end
module SG2 :
sig
type t = G.t
val e : t
val ( ** ) : t -> t -> t
val inv : t -> t
end
val f : SG1.t -> SG2.t
end
Modules do not match:
sig type t = G.t val e : t val ( ** ) : t -> t -> t end
is not included in
sig type t = G.t val e : t val ( ** ) : t -> t -> t val inv : t -> t
end
The field `inv' is required but not
provided
*)

--
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr

```