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
Wie kann ich auf die Art beziehen 'a t
definiert durch FOOable
da es nicht möglich ist Elt.t
zu benutzen?OCaml functors und Typ Themen
So in diesem Beispiel wäre es geworden 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