feat(uplc): add Case and Const terms

- parsering
- interning
- flat encoding and decoding
- pretty printing
- debruijn conversion

Co-authored-by: Lucas Rosa <x@rvcas.dev>
This commit is contained in:
microproofs
2023-08-01 22:33:25 -04:00
committed by Kasey
parent dfe433ea46
commit e566c4e1de
9 changed files with 213 additions and 8 deletions

View File

@@ -171,7 +171,7 @@ impl<'b> Decoder<'b> {
/// Otherwise we decode an item in the list with the decoder function passed in.
/// Then decode the next bit in the buffer and repeat above.
/// Returns a list of items decoded with the decoder function.
pub fn decode_list_with<T: Decode<'b>, F>(&mut self, decoder_func: F) -> Result<Vec<T>, Error>
pub fn decode_list_with<T, F>(&mut self, decoder_func: F) -> Result<Vec<T>, Error>
where
F: Copy + FnOnce(&mut Decoder) -> Result<T, Error>,
{

View File

@@ -196,10 +196,7 @@ impl Encoder {
&mut self,
list: &[T],
encoder_func: for<'r> fn(&T, &'r mut Encoder) -> Result<(), Error>,
) -> Result<&mut Self, Error>
where
T: Encode,
{
) -> Result<&mut Self, Error> {
for item in list {
self.one();
encoder_func(item, self)?;