I have the following code in OCaml that produces the error " Unbound type constructor variable" :
module OrderedVar = struct
type t = variable
let compare v1 v2 = v1#get_name - v2#get_name
end
module VarSet = Set.Make(OrderedVar)
class variable n =
object
val mutable name = n
method get_name = name
end
How can I declare the type "variable" ?
Thank you
edit :
thank you for your answers but my probleme is a bit more difficult. In fact, I have two modules and two classes that "interlaced". Here, I can't declare the classes "variable" and "clause" before the modules, because they need the modules :
module OrderedVar = struct
type t = variable
let compare v1 v2 = v1#get_name - v2#get_name
end
module VarSet = Set.Make(OrderedVar)
module OrderedClause = struct
type t = clause
let compare = compare
end
module ClauseSet = Set.Make(OrderedClause)
class variable n =
object
val mutable name = n
val mutable cpos = ClauseSet.empty
method get_name = name
end
class clause =
object
val mutable vpos = VarSet.empty
end