aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/evaluators/FOL.ml2
-rw-r--r--lib/evaluators/Lambda.ml3
-rw-r--r--lib/kernel/Branch.ml2
-rw-r--r--lib/kernel/BranchManager.ml2
-rw-r--r--lib/kernel/Generator.ml2
-rw-r--r--lib/kernel/Multigroup.ml2
-rw-r--r--lib/kernel/Namespace.ml2
-rw-r--r--lib/kernel/Prototype.ml2
-rw-r--r--lib/kernel/SubstantialRelation.ml3
-rw-r--r--lib/kernel/Tuple.ml2
-rw-r--r--lib/protocols/Handle.ml10
-rw-r--r--lib/protocols/Handle.mli2
12 files changed, 31 insertions, 3 deletions
diff --git a/lib/evaluators/FOL.ml b/lib/evaluators/FOL.ml
index b290e0a..eba57a1 100644
--- a/lib/evaluators/FOL.ml
+++ b/lib/evaluators/FOL.ml
@@ -31,6 +31,8 @@ class evaluator = object (self)
inherit Kernel.Lifecycle.null
inherit Kernel.Identity.of_id
+ method to_string = "fol-evaluator"
+
method invoke = execute
method protocols : Protocols.Handle.protocol list = [Program.make self]
end
diff --git a/lib/evaluators/Lambda.ml b/lib/evaluators/Lambda.ml
index a75fc10..53b0301 100644
--- a/lib/evaluators/Lambda.ml
+++ b/lib/evaluators/Lambda.ml
@@ -98,6 +98,9 @@ let execute term =
class evaluator = object (self)
inherit Kernel.Lifecycle.null
inherit Kernel.Identity.of_id
+
+ method to_string = "lambda-evaluator"
+
method invoke program = execute program
method protocols : Protocols.Handle.protocol list = [Program.make self]
end
diff --git a/lib/kernel/Branch.ml b/lib/kernel/Branch.ml
index b8d331f..1e7794e 100644
--- a/lib/kernel/Branch.ml
+++ b/lib/kernel/Branch.ml
@@ -63,6 +63,8 @@ module Make (S : Abstract.Storage.STORAGE) = struct
class branch storage value node = object (self)
inherit Lifecycle.null
+ method to_string = "branch"
+
val storage : S.connection = storage
val branch : t = value
val node = node (* FIXME: can we not place this inside `t`? *)
diff --git a/lib/kernel/BranchManager.ml b/lib/kernel/BranchManager.ml
index 1162b40..bda4233 100644
--- a/lib/kernel/BranchManager.ml
+++ b/lib/kernel/BranchManager.ml
@@ -28,6 +28,8 @@ module Make (S : Abstract.Storage.STORAGE) = struct
inherit Lifecycle.null
inherit Identity.of_id
+ method to_string = "branch-manager"
+
val storage : S.connection = storage
val label : string = label
val head : M.node Atomic.t = Atomic.make head
diff --git a/lib/kernel/Generator.ml b/lib/kernel/Generator.ml
index e4a15f8..10f6865 100644
--- a/lib/kernel/Generator.ml
+++ b/lib/kernel/Generator.ml
@@ -15,6 +15,8 @@ class producer_cursor produce on_release =
inherit Lifecycle.null
inherit Identity.of_id
+ method to_string = "producer-cursor"
+
val mutable state : [`Fresh | `Live of (unit, step) Effect.Deep.continuation | `Done] = `Fresh
method protocols : Protocols.Handle.protocol list = Protocols.[Cursor.make self]
method private step : (Concepts.Tuple.t option, Concepts.Condition.condition) result =
diff --git a/lib/kernel/Multigroup.ml b/lib/kernel/Multigroup.ml
index 685c8c7..e5e36cf 100644
--- a/lib/kernel/Multigroup.ml
+++ b/lib/kernel/Multigroup.ml
@@ -41,6 +41,8 @@ module Make (S : Abstract.Storage.STORAGE) = struct
class multigroup conn value node = object
inherit Lifecycle.null
+ method to_string = "multigroup"
+
val multigroup = value
val storage = conn
val node = node (* FIXME: see the comment on Branch.ml *)
diff --git a/lib/kernel/Namespace.ml b/lib/kernel/Namespace.ml
index 507afa4..728c307 100644
--- a/lib/kernel/Namespace.ml
+++ b/lib/kernel/Namespace.ml
@@ -2,6 +2,8 @@ class namespace = object (self)
inherit Lifecycle.null
inherit Identity.of_id
+ method to_string = "namespace"
+
val entries : (string, Protocols.Handle.t) BatMap.t Atomic.t =
Atomic.make BatMap.empty
diff --git a/lib/kernel/Prototype.ml b/lib/kernel/Prototype.ml
index 65de68f..1d0751a 100644
--- a/lib/kernel/Prototype.ml
+++ b/lib/kernel/Prototype.ml
@@ -4,6 +4,8 @@ let mixture ps = Protocols.Handle.make @@
inherit Identity.of_id (* Should we allow the user to override this? *)
method protocols = ps
+
+ method to_string = "mixture"
end
let rec mixture_of value f =
diff --git a/lib/kernel/SubstantialRelation.ml b/lib/kernel/SubstantialRelation.ml
index 0afc3f7..136c146 100644
--- a/lib/kernel/SubstantialRelation.ml
+++ b/lib/kernel/SubstantialRelation.ml
@@ -146,6 +146,9 @@ module Make (S : Abstract.Storage.STORAGE) = struct
class relation storage value =
object (self)
inherit Lifecycle.null
+
+ method to_string = "relation"
+
val storage : S.connection = storage
val relation : t = value
method predicate = Ok relation.predicate
diff --git a/lib/kernel/Tuple.ml b/lib/kernel/Tuple.ml
index ef591ae..bbc20ab 100644
--- a/lib/kernel/Tuple.ml
+++ b/lib/kernel/Tuple.ml
@@ -117,6 +117,8 @@ module Make (S : Abstract.Storage.STORAGE) = struct
class tuple ~relation conn value node = object (self)
inherit Lifecycle.null
+ method to_string = "tuple"
+
val tuple = value
val storage = conn
val node = node
diff --git a/lib/protocols/Handle.ml b/lib/protocols/Handle.ml
index cb78cf2..c45afb0 100644
--- a/lib/protocols/Handle.ml
+++ b/lib/protocols/Handle.ml
@@ -3,14 +3,16 @@ type protocol = ..
module Error = struct
open Concepts.Condition
- let unimplemented_protocol () = condition "unimplemented-protocol" "A required protocol was not implemented by the specified object"
- empty
+ let unimplemented_protocol obj_name =
+ condition "unimplemented-protocol" "A required protocol was not implemented by the specified object"
+ ("object" |=| Concepts.Value.String obj_name)
end
class type obj = object
method reference : bool
method release : unit
method hash : Concepts.Hash.hash
+ method to_string : string
method protocols : protocol list
end
@@ -50,9 +52,11 @@ let equal h1 h2 =
let hash h = (object_of h)#hash
+let to_string h = (object_of h)#to_string
+
let release ({ valid; _ } as handle) =
let o = object_of handle in
valid := false;
o#release
-let require f h = Option.to_result ~none:(Error.unimplemented_protocol ()) (f h)
+let require f h = Option.to_result ~none:(Error.unimplemented_protocol (to_string h)) (f h)
diff --git a/lib/protocols/Handle.mli b/lib/protocols/Handle.mli
index 5640b14..daee453 100644
--- a/lib/protocols/Handle.mli
+++ b/lib/protocols/Handle.mli
@@ -8,6 +8,7 @@ class type obj = object
method reference : bool
method release : unit
method hash : Concepts.Hash.hash
+ method to_string : string
method protocols : protocol list
end
@@ -23,5 +24,6 @@ val equal : t -> t -> bool
val release : t -> unit
val hash : t -> Concepts.Hash.hash
+val to_string : t -> string
val require : (t -> 'a interface option) -> t -> ('a interface, Concepts.Condition.condition) result