summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/builtins.rs
diff options
context:
space:
mode:
authorNadrieril2020-02-09 21:58:28 +0000
committerNadrieril2020-02-09 21:58:28 +0000
commit21db63d3e614554f258526182c7ed89a2c244b65 (patch)
treeb222217123f53774e2c5c70160c3fc48e08045fc /dhall/src/semantics/builtins.rs
parenta709c65eb28f1b6a666f15bfc2255da7bc7105ab (diff)
Take Hir for typecheck
Diffstat (limited to 'dhall/src/semantics/builtins.rs')
-rw-r--r--dhall/src/semantics/builtins.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/dhall/src/semantics/builtins.rs b/dhall/src/semantics/builtins.rs
index 715e045..b1d12aa 100644
--- a/dhall/src/semantics/builtins.rs
+++ b/dhall/src/semantics/builtins.rs
@@ -1,5 +1,5 @@
use crate::semantics::{
- typecheck, Hir, HirKind, NzEnv, Value, ValueKind, VarEnv,
+ skip_resolve, typecheck, Hir, HirKind, NzEnv, Value, ValueKind, VarEnv,
};
use crate::syntax::map::DupTreeMap;
use crate::syntax::Const::Type;
@@ -115,9 +115,9 @@ macro_rules! make_type {
};
}
-pub(crate) fn type_of_builtin<E>(b: Builtin) -> Expr<E> {
+pub(crate) fn type_of_builtin(b: Builtin) -> Hir {
use Builtin::*;
- match b {
+ let expr = match b {
Bool | Natural | Integer | Double | Text => make_type!(Type),
List | Optional => make_type!(
Type -> Type
@@ -200,7 +200,8 @@ pub(crate) fn type_of_builtin<E>(b: Builtin) -> Expr<E> {
OptionalNone => make_type!(
forall (A: Type) -> Optional A
),
- }
+ };
+ skip_resolve(&expr).unwrap()
}
// Ad-hoc macro to help construct closures
@@ -264,7 +265,8 @@ fn apply_builtin(b: Builtin, args: Vec<Value>, env: NzEnv) -> ValueKind {
Value(Value),
DoneAsIs,
}
- let make_closure = |e| typecheck(&e).unwrap().eval(&env);
+ let make_closure =
+ |e| typecheck(&skip_resolve(&e).unwrap()).unwrap().eval(&env);
let ret = match (b, args.as_slice()) {
(OptionalNone, [t]) => Ret::ValueKind(EmptyOptionalLit(t.clone())),