Version française
Home     About     Download     Resources     Contact us    
Browse thread
Typage des modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel Bonniot <dbonniot@e...>
Subject: Typage des modules

Bonjour,

Comment resoudre le probleme suivant ?
Le module A declare un type a, le module B renvoie une valeur de type a
et A utilise B dans son implementation :

(* a.mli *)
type a
val v:a

(* a.ml *)
type a = { x: int}
let v = B.f {x=3}


(* b.mli *)
val f : A.a-> A.a

(* b.ml *)
let f x =x


Voici le resultat des compilations:
moo>ls
a.ml   a.mli  b.ml   b.mli
moo>ocamlc -c a.mli
moo>ocamlc -c b.mli
moo>ocamlc -c a.ml 
File "a.ml", line 2, characters 12-17:
This expression has type a but is here used with type A.a
moo>

Cette erreur est logique etant donne le systeme de typage des modules,
mais comment ecrire ce genre de dependances ?

Daniel Bonniot