summaryrefslogtreecommitdiff
path: root/dhall/src/core
diff options
context:
space:
mode:
authorNadrieril2019-08-16 19:16:40 +0200
committerNadrieril2019-08-16 19:16:40 +0200
commit45fb07f74f19919f742be6fe7793dc72d4022f26 (patch)
treefffab6fdb5b59e6e32eec60b3c4adfa5835e4778 /dhall/src/core
parentfcc9afb3624883c4f99320c37678b7f9d338630d (diff)
Try to minimize untyped TypedThunks
Diffstat (limited to 'dhall/src/core')
-rw-r--r--dhall/src/core/thunk.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/dhall/src/core/thunk.rs b/dhall/src/core/thunk.rs
index 87541d3..5f96ec8 100644
--- a/dhall/src/core/thunk.rs
+++ b/dhall/src/core/thunk.rs
@@ -182,11 +182,7 @@ impl Thunk {
impl TypedThunk {
pub(crate) fn from_value(v: Value) -> TypedThunk {
- TypedThunk::from_thunk(Thunk::from_value(v))
- }
-
- pub fn from_thunk(th: Thunk) -> TypedThunk {
- TypedThunk::from_thunk_untyped(th)
+ TypedThunk::from_thunk_untyped(Thunk::from_value(v))
}
pub(crate) fn from_type(t: Type) -> TypedThunk {
@@ -216,14 +212,17 @@ impl TypedThunk {
pub(crate) fn from_thunk_and_type(th: Thunk, t: Type) -> Self {
TypedThunk::Typed(th, Box::new(t))
}
+ pub fn from_thunk_simple_type(th: Thunk) -> Self {
+ TypedThunk::from_thunk_and_type(th, Type::const_type())
+ }
pub(crate) fn from_thunk_untyped(th: Thunk) -> Self {
TypedThunk::Untyped(th)
}
pub(crate) fn from_const(c: Const) -> Self {
TypedThunk::Const(c)
}
- pub(crate) fn from_value_untyped(v: Value) -> Self {
- TypedThunk::from_thunk_untyped(Thunk::from_value(v))
+ pub(crate) fn from_value_and_type(v: Value, t: Type) -> Self {
+ TypedThunk::from_thunk_and_type(Thunk::from_value(v), t)
}
// TODO: Avoid cloning if possible