1
module type FOOable = sig
type 'a t
val foo : 'a -> 'a t
end
module type FOO_FUCNTOR =
functor (Elt : FOOable) ->
sig
type 'a t
val foo_alias : 'a -> 'a t
(* ... *)
end
Comment puis-je me réfère au type 'a t
défini par FOOable
car il est impossible d'utiliser Elt.t
?foncteurs OCaml et les questions de type
Ainsi, dans cet exemple, il deviendrait type 'a t = 'a list
module MakeFoo : FOO_FUNCTOR =
functor (Elt : FOOable) ->
struct
type 'a t = ??? (* I want the type 'a t belonging to Elt *)
let foo_alias = Elt.foo
end
module FooableList = struct
type = 'a list
let foo x = [x]
end
module FooList = MakeFoo(FooableList)
let a = FooList.foo_alias 2