summaryrefslogtreecommitdiff
path: root/compiler/PureUtils.ml
diff options
context:
space:
mode:
authorSon Ho2023-11-09 12:33:14 +0100
committerSon Ho2023-11-09 12:33:14 +0100
commit9254f5aeadfc9d17f31e13c61a7843364220c4ed (patch)
tree91eeb1fa1bba480e1ec97b7a86cbeb27e715f5fe /compiler/PureUtils.ml
parentc57dec640d4e12c3dc66969d626bbbca2eb733fd (diff)
Progress on making the traits work for F*
Diffstat (limited to 'compiler/PureUtils.ml')
-rw-r--r--compiler/PureUtils.ml35
1 files changed, 35 insertions, 0 deletions
diff --git a/compiler/PureUtils.ml b/compiler/PureUtils.ml
index 4e44f252..3aeabffe 100644
--- a/compiler/PureUtils.ml
+++ b/compiler/PureUtils.ml
@@ -642,3 +642,38 @@ let trait_decl_get_method (trait_decl : trait_decl) (method_name : string) :
List.find (fun (s, _) -> s = method_name) trait_decl.provided_methods
in
{ is_provided = true; id = Option.get id }
+
+let trait_decl_is_empty (trait_decl : trait_decl) : bool =
+ let {
+ def_id = _;
+ name = _;
+ generics = _;
+ preds = _;
+ parent_clauses;
+ consts;
+ types;
+ required_methods;
+ provided_methods;
+ } =
+ trait_decl
+ in
+ parent_clauses = [] && consts = [] && types = [] && required_methods = []
+ && provided_methods = []
+
+let trait_impl_is_empty (trait_impl : trait_impl) : bool =
+ let {
+ def_id = _;
+ name = _;
+ impl_trait = _;
+ generics = _;
+ preds = _;
+ parent_trait_refs;
+ consts;
+ types;
+ required_methods;
+ provided_methods;
+ } =
+ trait_impl
+ in
+ parent_trait_refs = [] && consts = [] && types = [] && required_methods = []
+ && provided_methods = []