4
나는 그렇지 컴파일 가능한 C입니다어떻게 포함합니까?
module type T = sig
type t
end
및
module Make (TypeProvider : T) = struct
include TypeProvider
type d = Wrapped of t
end
및
module Test = struct
include Make (struct type t = ForWrap end)
let f = function | Wrapped ForWrap ->()
end
내가
module Test = struct
type t = ForWrap
type d = Wrapped of t
let f = function | Wrapped ForWrap ->()
end
좋아하지만 실시간으로 컴파일 후 테스트를 상상 송시.
module Test = struct
include Make (struct type t = ForWrap end)
let f = function | Wrapped ForWrap ->()
^^^^^^^
Error: Unbound constructor ForWrap
end
그리고 그 이유를 이해할 수 없다 : OCaml의 날을 말한다. 내 솔루션의 문제점은 무엇입니까?
module M = Make(struct type t = ForWrapp end)
ocamlc -c -i xxx.ml
당신이 모듈의 서명을 보여줍니다 :
펑터 응용 프로그램은 런타임 작업이므로 "include"를 순수한 구문 수준 대체로 처리 할 수 없습니다 – objmagic