diff options
author | Nadrieril | 2020-03-08 21:47:26 +0000 |
---|---|---|
committer | Nadrieril | 2020-03-31 21:44:01 +0100 |
commit | 94850b720b0171444694452027f1baf947b3c18f (patch) | |
tree | acbc73273f9b0cfd3abd41038ad028c78ffa937c /dhall/src/lib.rs | |
parent | 4e11e882b7d064e9ddf997f9a465206cf6e471aa (diff) |
Add SimpleType to mirror SimpleValue
Diffstat (limited to '')
-rw-r--r-- | dhall/src/lib.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs index 0be6db3..25196ba 100644 --- a/dhall/src/lib.rs +++ b/dhall/src/lib.rs @@ -30,7 +30,7 @@ pub type ParsedExpr = Expr; pub type DecodedExpr = Expr; pub type ResolvedExpr = Expr; pub type NormalizedExpr = Expr; -pub use crate::simple::{SValKind, SimpleValue}; +pub use crate::simple::{STyKind, SValKind, SimpleType, SimpleValue}; #[derive(Debug, Clone)] pub struct Parsed(ParsedExpr, ImportLocation); @@ -146,6 +146,10 @@ impl Normalized { pub fn to_simple_value(&self) -> Result<SimpleValue, Expr> { self.0.to_simple_value().ok_or_else(|| self.to_expr()) } + /// Converts a value into a SimpleType. + pub fn to_simple_type(&self) -> Result<SimpleType, Expr> { + self.0.to_simple_type().ok_or_else(|| self.to_expr()) + } /// Converts a value back to the corresponding Hir expression. pub(crate) fn to_hir(&self) -> Hir { self.0.to_hir_noenv() |