1 unstable release

0.1.0 Feb 1, 2024

#64 in #prelude


Used in plutus-ledger-api

Apache-2.0

26KB
667 lines

Lambda Buffers

LambdaBuffers banner

Introduction

LambdaBuffers is a schema language (similar to ProtoBuffers, ADL, ASN.1, JSON Schema, etc.) and associated code generation toolkit. The goal of this project is to provide developers tools to define algebraic data types in a language-agnostic format such that shared data types can be declared in one place while maintaining compatibility across a plethora of supported languages.

Users may refer to the comparison matrix for an in-depth comparison of LambdaBuffers' features against the feature-set of other popular schema-languages.

At a glance, you may wish to choose LambdaBuffers instead of one of its competitors if your project requires:

  1. Parameterized Data Types (aka. type functions): Unlike ProtoBuffers or JSON Schema, LambdaBuffers allows users to define algebraic data types which take type variable arguments. If your project's domain is most accurately represented by parameterized data types, LambdaBuffers may be a good choice for your needs.

  2. Opaque Types: Almost every competing schema language provides users a fixed set of builtin or primitive types, which are handled in a special manner by the code generation and cannot be extended. LambdaBuffers, by contrast, allows users to add their own builtin types and extend the existing code generation framework to handle those builtins in a manner intended by the users. There are no special primitive types in LambdaBuffers; a user-defined primitive type is defined in exactly the same way (i.e. as an opaque type) as a LambdaBuffers "builtin".

  3. Typeclass Support: While nearly every schema language supports generating type definitions in supported target languages, to our knowledge no schema language supports generating commonly used functions that operate on those types. Unlike other schema languages, LambdaBuffers supports code generation for typeclass instances (or the equivalent in languages that lack support for typeclasses) to reduce the amount of boilerplate required to productively make use of the generated types. While LambdaBuffers is still a work-in-progress, we expect that, upon completion, an extensive test suite will provide a high degree of assurance that the instances/methods generated by the LambdaBuffers code generator behave identically.

Documentation

Visit LambdaBuffers Github Pages.

Acknowledgements

This project was graciously funded by the Cardano Treasury in Catalyst Fund 9 and Catalyst Fund 10.

Authors:

Contributors:


lib.rs:

Lambda Buffers Runtime Prelude

Common functionality for Lamba Buffer types.

Dependencies

~3–12MB
~123K SLoC