summaryrefslogtreecommitdiff
path: root/dhall/src/expr.rs
diff options
context:
space:
mode:
authorNadrieril2019-04-11 13:14:13 +0200
committerNadrieril2019-04-11 13:14:13 +0200
commitd3f14966120fae672dc890b718ebada74ebed533 (patch)
tree887b4af84bc2c69886616a4a9c8aa27fa846238a /dhall/src/expr.rs
parent982f86c34f69bb78b45a4b8b37a5bf5731f881eb (diff)
parent82d62c4d7d423817a4fd9d6294d27d18d60bcd22 (diff)
Merge branch 'serde'
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)
+ }
+}