summaryrefslogtreecommitdiff
path: root/dhall/src/expr.rs
diff options
context:
space:
mode:
authorNadrieril2019-04-10 19:16:11 +0200
committerNadrieril2019-04-10 19:16:11 +0200
commite1a30c6f248c0c17c97598290a0d94993dbb0325 (patch)
tree960eb4029f2ba9a824e34219915e942b1b65e4cd /dhall/src/expr.rs
parent982f86c34f69bb78b45a4b8b37a5bf5731f881eb (diff)
Add SimpleType and SimpeStaticType. Derive the latter
Diffstat (limited to 'dhall/src/expr.rs')
-rw-r--r--dhall/src/expr.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/dhall/src/expr.rs b/dhall/src/expr.rs
index 7baf628..5ff097b 100644
--- a/dhall/src/expr.rs
+++ b/dhall/src/expr.rs
@@ -36,6 +36,11 @@ derive_other_traits!(Typed);
pub struct Normalized(pub(crate) SubExpr<X, X>, pub(crate) Type);
derive_other_traits!(Normalized);
+/// An expression of type `Type` (like `Bool` or `Natural -> Text`, but not `Type`)
+#[derive(Debug, Clone, Eq)]
+pub struct SimpleType(pub(crate) SubExpr<X, X>);
+derive_other_traits!(SimpleType);
+
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Type(pub(crate) TypeInternal);
@@ -44,3 +49,19 @@ pub(crate) enum TypeInternal {
Expr(Box<Normalized>),
Untyped,
}
+
+// Exposed for the macros
+#[doc(hidden)]
+impl From<SimpleType> for SubExpr<X, X> {
+ fn from(x: SimpleType) -> SubExpr<X, X> {
+ x.0
+ }
+}
+
+// Exposed for the macros
+#[doc(hidden)]
+impl From<SubExpr<X, X>> for SimpleType {
+ fn from(x: SubExpr<X, X>) -> SimpleType {
+ SimpleType(x)
+ }
+}