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
は、どのように私はElt.t
を使用することはできませんようFOOable
で定義された型'a t
を参照することができますか?OCamlのファンクタとタイプの問題
したがって、この例では、それはあなたが単に'a Elt.t
を入力することができますし、右のタイプを必ず参照してくださいよ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