aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jason Gross <jagro@google.com>2016-09-16 12:02:43 -0700
committerGravatar Jason Gross <jagro@google.com>2016-09-16 12:02:43 -0700
commitc4534292b08de0a02f6dd9b63bdcde04ef03db89 (patch)
treee275e5a1e8c988d378b764da3edd0aa5b1e5f9dc /src
parent2ab5de84a35cee04cc2768d88efcb684f1563507 (diff)
Add SmartVal
Diffstat (limited to 'src')
-rw-r--r--src/Reflection/Syntax.v6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Reflection/Syntax.v b/src/Reflection/Syntax.v
index 03e8b21a0..45ab931cb 100644
--- a/src/Reflection/Syntax.v
+++ b/src/Reflection/Syntax.v
@@ -116,6 +116,12 @@ Section language.
(@smart_interp_flat_map f g h pair A (fst v))
(@smart_interp_flat_map f g h pair B (snd v))
end.
+ Fixpoint SmartVal {T} (val : forall t : base_type_code, T t) t : interp_flat_type_gen T t
+ := match t return interp_flat_type_gen T t with
+ | Tbase _ => val _
+ | Prod A B => (@SmartVal T val A, @SmartVal T val B)
+ end.
+ := @smart_interp_flat_map _ (interp_flat_type_gen exprf) (fun t => Const) (fun A B x y => pair x y) t.
(** [SmartVar] is like [Var], except that it inserts
pair-projections and [Pair] as necessary to handle
[flat_type], and not just [base_type_code] *)