diff options
author | Nadrieril Feneanar | 2019-08-10 23:15:13 +0200 |
---|---|---|
committer | GitHub | 2019-08-10 23:15:13 +0200 |
commit | b41e0278eda19a495daf0586693f1b5981a89653 (patch) | |
tree | cedc8ca740ca0d0bbc74fc987cc0c041f0391b91 /dhall/src/phase/binary.rs | |
parent | 674fbdc33c788156f76d263b044dccc48c810870 (diff) | |
parent | 80c8d87db595c91293af75d710464ac5379c7e28 (diff) |
Merge pull request #98 from Nadrieril/catchup-spec
Catchup spec
Diffstat (limited to 'dhall/src/phase/binary.rs')
-rw-r--r-- | dhall/src/phase/binary.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/dhall/src/phase/binary.rs b/dhall/src/phase/binary.rs index 5e7eb40..f4a9cc1 100644 --- a/dhall/src/phase/binary.rs +++ b/dhall/src/phase/binary.rs @@ -119,6 +119,7 @@ fn cbor_value_to_dhall( 9 => RightBiasedRecordMerge, 10 => RecursiveRecordTypeMerge, 11 => ImportAlt, + 12 => Equivalence, _ => { Err(DecodeError::WrongFormatError("binop".to_owned()))? } @@ -177,6 +178,19 @@ fn cbor_value_to_dhall( let l = Label::from(l.as_str()); Field(x, l) } + [U64(10), x, rest..] => { + let x = cbor_value_to_dhall(&x)?; + let labels = rest + .iter() + .map(|s| match s { + String(s) => Ok(Label::from(s.as_str())), + _ => Err(DecodeError::WrongFormatError( + "projection".to_owned(), + )), + }) + .collect::<Result<_, _>>()?; + Projection(x, labels) + } [U64(11), Object(map)] => { let map = cbor_map_to_dhall_opt_map(map)?; UnionType(map) @@ -211,6 +225,10 @@ fn cbor_value_to_dhall( .collect::<Result<_, _>>()?, ))) } + [U64(19), t] => { + let t = cbor_value_to_dhall(&t)?; + Assert(t) + } [U64(24), hash, U64(mode), U64(scheme), rest..] => { let mode = match mode { 0 => ImportMode::Code, @@ -504,6 +522,7 @@ where ) } Annot(x, y) => ser_seq!(ser; tag(26), expr(x), expr(y)), + Assert(x) => ser_seq!(ser; tag(19), expr(x)), SomeLit(x) => ser_seq!(ser; tag(5), null(), expr(x)), EmptyListLit(x) => match x.as_ref() { App(f, a) => match f.as_ref() { @@ -541,6 +560,7 @@ where RightBiasedRecordMerge => 9, RecursiveRecordTypeMerge => 10, ImportAlt => 11, + Equivalence => 12, }; ser_seq!(ser; tag(3), U64(op), expr(x), expr(y)) } |