Si j'ai une implémentation (.re
) fichier contenantComment puis-je utiliser la signature de sortie d'un foncteur dans un fichier d'interface?
module IntMap =
Map.Make {
type t = int;
let compare = compare;
};
type foo = IntMap.t string;
comment puis-je ajouter la signature de foo
à l'interface (.rei
) fichier? Par analogie avec
module IntMap = Map.S with type key = int
type foo = string IntMap.t
Je pensais que ce serait
module IntMap =
Map.S {
type t = int;
};
type foo = IntMap.t string;
mais qui se traduit par une erreur de syntaxe à {
.
Ah, merci. Mes erreurs étaient 1) se référant à [un exemple invalide] (https://stackoverflow.com/review/suggested-edits/17241690) d'OCaml et 2) essayant de [convertir via Try Reason] (https: //reasonml.github .io/try /? ocaml = LYewJgrgNgpgBASQHYBcCyBDADgLjprAOgGU4B3ASxQAs4UBPLeAaxnrgF44LUg), qui signale une erreur de syntaxe dans le OCaml corrigé. –