recursive modules: Cannot safely evaluate the definition
[
Home
]
[ Index:
by date

by threads
]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
Date:   (:) 
From:  Hendrik Tews <tews@c...> 
Subject:  recursive modules: Cannot safely evaluate the definition 
Hi, for the following program module type Result_sig = sig val result : int end module type Build_sig = sig val compute : int > unit end module rec Rec : functor(Arg : Result_sig) > Build_sig = functor(Arg : Result_sig) > struct let compute = function  0 > Printf.printf "result: %d\n" Arg.result  n > let module Arg_x_2 = struct let result = Arg.result * 2 end in let module Rec_tail = Rec(Arg_x_2) in Rec_tail.compute (n1) end I get the compiler error Cannot safely evaluate the definition of the recursivelydefined module Rec Could somebody explain to me why? As far as I can see, module Rec is safe in the sense of section 7.9 of the reference manual. [Background: I am trying to solve the following Ocaml puzzle: Build a (nested) functor application, where the functors applied depend on an input value of the program. In particular the depth of the functor application depends on the input value and could be arbitrary high.] Bye, Hendrik