diff options
author | Matej Kosik <m4tej.kosik@gmail.com> | 2016-08-24 15:30:58 +0200 |
---|---|---|
committer | Matej Kosik <m4tej.kosik@gmail.com> | 2016-08-24 15:30:58 +0200 |
commit | 50f864e52d952ae59050d2bac1c05788b6393f18 (patch) | |
tree | 42ab532b4413958a114425b3dd3554a853eb1aee | |
parent | 8e38b0e46f9628bcface1e5dad39c876f1f3f318 (diff) |
Adding "Context.Named.Declaration.to_rel" function
-rw-r--r-- | kernel/context.ml | 8 | ||||
-rw-r--r-- | kernel/context.mli | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/kernel/context.ml b/kernel/context.ml index ca084b682..71969be85 100644 --- a/kernel/context.ml +++ b/kernel/context.ml @@ -346,6 +346,12 @@ struct LocalAssum (f na, t) | Rel.Declaration.LocalDef (na,v,t) -> LocalDef (f na, v, t) + + let to_rel = function + | LocalAssum (id,t) -> + Rel.Declaration.LocalAssum (Name id, t) + | LocalDef (id,v,t) -> + Rel.Declaration.LocalDef (Name id,v,t) end (** Named-context is represented as a list of declarations. @@ -399,7 +405,7 @@ struct | _ -> None in List.map_filter filter - end +end module NamedList = struct diff --git a/kernel/context.mli b/kernel/context.mli index 27d0f2c1b..ecc3987a5 100644 --- a/kernel/context.mli +++ b/kernel/context.mli @@ -195,8 +195,13 @@ sig val to_tuple : t -> Id.t * Constr.t option * Constr.t val of_tuple : Id.t * Constr.t option * Constr.t -> t - (** Convert [Rel.Declaration.t] value to the corresponding [Named.Declaration.t] value. *) + (** Convert [Rel.Declaration.t] value to the corresponding [Named.Declaration.t] value. + The function provided as the first parameter determines how to translate "names" to "ids". *) val of_rel : (Name.t -> Id.t) -> Rel.Declaration.t -> t + + (** Convert [Named.Declaration.t] value to the corresponding [Rel.Declaration.t] value. *) + (* TODO: Move this function to [Rel.Declaration] module and rename it to [of_named]. *) + val to_rel : t -> Rel.Declaration.t end (** Rel-context is represented as a list of declarations. |