Hello.
I've been trying to compile the recursive submodule that can be found at
the end of this email. I get the following compilation error
> Error: Cannot safely evaluate the definition
> of the recursively-defined module Registry
> Command exited with code 2.
I do not understand what this error mean. If someone knew, I'd be
grateful for their advice.
Guillaume Yziquel.
> module rec Registry : sig
>
> val new_status_signal : t -> status React.signal
> val registry : (t * status React.signal) list React.signal
> val status_of_agent : t -> status
>
> end = struct
>
> let new_status_signal agent = React.S.fold
> begin function current_status -> function
> | AgentPresent (agent_of_signal, status_information) ->
> begin match agent = agent_of_signal with
> | false -> current_status
> | true -> status_information
> end
> | AsteriskStatus (Asterisk.Active activity) ->
> let agent_ip = match Registry.status_of_agent agent with
> | Present ip -> Some ip
> | Online (ip, _) -> Some ip
> | _ -> None in
> begin match agent_ip with None -> current_status
> | Some ip -> current_status (* To do... *)
> end
> | AsteriskStatus _ -> current_status
> end Offline (React.E.select [
> agent_status_notification;
> (React.E.map begin function s -> AsteriskStatus s end
> (Asterisk.server # status_change))
> ])
>
> let registry = React.S.fold
> begin fun live_registry new_agent -> new_agent::live_registry end
> begin Lwt_main.run (persistent_registry >>= Ocsipersist.get >>=
> begin function a_list -> Lwt.return (List.map
> begin function (nom, prenom) ->
> let a = {nom = nom; prenom = prenom} in
> a, (Registry.new_status_signal a)
> end a_list)
> end)
> end
> begin React.E.map
> begin function agent -> agent, (Registry.new_status_signal agent) end
> adding_to_registry
> end
>
> let status_of_agent agent =
> try React.S.value (List.assoc agent (React.S.value Registry.registry))
> with Not_found -> raise (invalid_arg ("Agent.status_of_agent: "^agent.prenom^" "^agent.nom))
>
> end
--
Guillaume Yziquel
http://yziquel.homelinux.org/