English version
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.

Browse thread
Stupid question re:modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-08-24 (00:20)
From: Brian Hurt <bhurt@s...>
Subject: Stupid question re:modules

I should just know this.  So let's say I have two module types defined:

module type Foo = sig
 	type 'a t
 	val foo : 'a -> 'a t

module type Bar = sig
 	type 'a t
 	val bar : 'a -> 'a t

Now, I want to define a module that is both a Foo and a Bar without 
cutting and pasting the module definitions around.  I've been trying to 

module Baz : sig
 	type 'a baz
 	include Foo with type 'a t = 'a baz
 	include Bar with type 'a t = 'a baz

but this blows up on the Bar line (multiple definitions of 'a t).

There is a solution to this, I'm just being stupid and forgetting what it 
is.  Hints would be appreciated.