diff --git a/getting-started.html b/getting-started.html index 2b86ff3e..a2457e1f 100644 --- a/getting-started.html +++ b/getting-started.html @@ -192,7 +192,7 @@

pre-commit-check config file

+

To run all the code quality tooling specified in the pre-commit-check config file

diff --git a/haskell.html b/haskell.html index b65bbb47..27d88732 100644 --- a/haskell.html +++ b/haskell.html @@ -157,7 +157,7 @@

Document.lbf schema.

+

Let's now use lbf-prelude-to-haskell to process the Document.lbf schema.

module Document
 
 -- Importing types
diff --git a/plutarch.html b/plutarch.html
index e15ce306..30f99e0d 100644
--- a/plutarch.html
+++ b/plutarch.html
@@ -180,19 +180,19 @@ 

LambdaBuffers modules

Writing .lbf schemas with API types intended for Plutarch backend will typically use the following LambdaBuffers schema modules:

    -
  1. Prelude,
  2. -
  3. Plutus.V1,
  4. -
  5. Plutus.V2.
  6. +
  7. Prelude,
  8. +
  9. Plutus.V1,
  10. +
  11. Plutus.V2.
-

Take a look at Example.lbf schema as an example.

+

Take a look at Example.lbf schema as an example.

Haskell libraries

The necessary LambdaBuffers runtime libraries a typical Plutarch project needs when working with LambdaBuffers:

    -
  1. lbr-plutarch a Haskell runtime library necessary for working with lbf-xyz libraries.
  2. -
  3. lbf-prelude-plutarch that contains the LambdaBuffers Prelude schema library generated by LambdaBuffers.
  4. -
  5. lbf-plutus-plutarch that contains the LambdaBuffers Plutus schema library generated by LambdaBuffers.
  6. +
  7. lbr-plutarch a Haskell runtime library necessary for working with lbf-xyz libraries.
  8. +
  9. lbf-prelude-plutarch that contains the LambdaBuffers Prelude schema library generated by LambdaBuffers.
  10. +
  11. lbf-plutus-plutarch that contains the LambdaBuffers Plutus schema library generated by LambdaBuffers.
-

Of course, additional imports for Plutarch libraries are also necessary plutarch and optionally plutarch-extra.

+

Of course, additional imports for Plutarch libraries are also necessary plutarch and optionally plutarch-extra.

For a full example see Example.

Inspecting the generated output

You can inspect the generated libraries using Nix:

@@ -225,10 +225,10 @@

Haskell modul import Plutarch.Api.V2 ()

    -
  1. LambdaBuffers.Plutus.V1.Plutarch is a module generated from Plutus.V1 LambdaBuffers schema and provided by the lbf-plutus-plutarch runtime library.
  2. -
  3. LambdaBuffers.Plutus.V2.Plutarch is a module generated from Plutus.V2 LambdaBuffers schema and provided by the lbf-plutus-plutarch runtime library.
  4. -
  5. LambdaBuffers.Prelude.Plutarch is a module generated from Prelude LambdaBuffers schema and provided by the lbf-prelude-plutarch runtime library.
  6. -
  7. LambdaBuffers.Runtime.Plutarch is a module provided by the lbr-plutarch runtime library.
  8. +
  9. LambdaBuffers.Plutus.V1.Plutarch is a module generated from Plutus.V1 LambdaBuffers schema and provided by the lbf-plutus-plutarch runtime library.
  10. +
  11. LambdaBuffers.Plutus.V2.Plutarch is a module generated from Plutus.V2 LambdaBuffers schema and provided by the lbf-plutus-plutarch runtime library.
  12. +
  13. LambdaBuffers.Prelude.Plutarch is a module generated from Prelude LambdaBuffers schema and provided by the lbf-prelude-plutarch runtime library.
  14. +
  15. LambdaBuffers.Runtime.Plutarch is a module provided by the lbr-plutarch runtime library.

Generated Plutarch module for a LambdaBuffers schema Foo/Bar.lbf (ie. Foo.Bar) is stored at Foo/Bar/Plutarch.hs

@@ -262,11 +262,11 @@

RestrictionsFor example the Foo record defined above would have no difference in Plutarch if it was defined as product Foo below:

prod Foo = Integer Bool
 
-

The Plutarch backend doesn't support the use of Char, Text, Bytes (there's a Plutus.V1.Bytes), Set and Map (there's a Plutus.V1.Map) from LambdaBuffers Prelude module.

+

The Plutarch backend doesn't support the use of Char, Text, Bytes (there's a Plutus.V1.Bytes), Set and Map (there's a Plutus.V1.Map) from LambdaBuffers Prelude module.

Plutarch

Type definition mapping

-

Plutarch backend supports all types from the LambdaBuffers Plutus schema library, as to enable full featured Plutus script development.

-

Additionally, it also supports some types from the LambdaBuffers Prelude schema library, namely Bool, Integer, Maybe, Either and List.

+

Plutarch backend supports all types from the LambdaBuffers Plutus schema library, as to enable full featured Plutus script development.

+

Additionally, it also supports some types from the LambdaBuffers Prelude schema library, namely Bool, Integer, Maybe, Either and List.

module Foo
 
 sum Sum = Some a | Nothing
@@ -390,7 +390,7 @@ 

PShow

All generated types have a PShow instance derived using the internal Plutarch deriving mechanism.

PShow serves to stringify Plutarch types which is very useful during debugging.

Example

-

Let work through the Plutarch example available in the repo.

+

Let work through the Plutarch example available in the repo.

First, please check the Getting started guide on how to prepare to work with the repo and setup Nix.

Let's see what we have here:

lambda-buffers/docs/plutarch ❯ find
@@ -407,8 +407,8 @@ 

Example

The salient bits we should focus on are:

    -
  1. The LambdaBuffers .lbf schema in ./api/Example.lbf that describes the API types used by our little program,
  2. -
  3. The Haskell Plutarch program in ./app/Example.hs that works with the API types.
  4. +
  5. The LambdaBuffers .lbf schema in ./api/Example.lbf that describes the API types used by our little program,
  6. +
  7. The Haskell Plutarch program in ./app/Example.hs that works with the API types.

To inspect the generated library:

lambda-buffers/docs/plutarch ❯ nix build .#lbf-plutarch-example-api
@@ -423,7 +423,7 @@ 

Example

The name of the generated library lbf-plutarch-example-api is set in the ./plutarch/build.nix Nix build file.

However, it's not expected for users to need to do this. If you have any issue please reach out.

-

Inspecting the Cabal file shows the standard runtime libraries we need:

+

Inspecting the Cabal file shows the standard runtime libraries we need:

lambda-buffers/docs/plutarch ❯ cabal info .
 * plutarch-example-0.1.0.0 (program)
     Synopsis:      LambdaBuffers Plutarch example
@@ -446,7 +446,7 @@ 

Example

lambda-buffers/docs/plutarch ❯ cabal run
 "Friends, peace and love!!!"
 
-

Take a look at the Example.hs to see how generated types are used, namely how they are constructed with pcon and deconstructed with pmatch (or pmatchC).

+

Take a look at the Example.hs to see how generated types are used, namely how they are constructed with pcon and deconstructed with pmatch (or pmatchC).

diff --git a/print.html b/print.html index 827ce483..d1730408 100644 --- a/print.html +++ b/print.html @@ -236,7 +236,7 @@

pre-commit-check config file

+

To run all the code quality tooling specified in the pre-commit-check config file

LambdaBuffers to Haskell

Let's take a look at how LambdaBuffers modules map into Haskell modules and how LambdaBuffers type definitions map into Haskell type definitions.

@@ -250,7 +250,7 @@

Document.lbf schema.

+

Let's now use lbf-prelude-to-haskell to process the Document.lbf schema.

module Document
 
 -- Importing types
@@ -357,7 +357,7 @@ 

Record types

Or we can simply just refer directly to the lbf-prelude-to-purescript CLI by nix run github:mlabs-haskell/lambda-buffers#lbf-prelude-to-purescript.

In this chapter, we're going to use the latter option.

-

Let's now use lbf-prelude-to-purescript to process the Document.lbf schema

+

Let's now use lbf-prelude-to-purescript to process the Document.lbf schema

module Document
 
 -- Importing types
@@ -504,19 +504,19 @@ 

Record typesLambdaBuffers modules

Writing .lbf schemas with API types intended for Plutarch backend will typically use the following LambdaBuffers schema modules:

    -
  1. Prelude,
  2. -
  3. Plutus.V1,
  4. -
  5. Plutus.V2.
  6. +
  7. Prelude,
  8. +
  9. Plutus.V1,
  10. +
  11. Plutus.V2.
-

Take a look at Example.lbf schema as an example.

+

Take a look at Example.lbf schema as an example.

Haskell libraries

The necessary LambdaBuffers runtime libraries a typical Plutarch project needs when working with LambdaBuffers:

    -
  1. lbr-plutarch a Haskell runtime library necessary for working with lbf-xyz libraries.
  2. -
  3. lbf-prelude-plutarch that contains the LambdaBuffers Prelude schema library generated by LambdaBuffers.
  4. -
  5. lbf-plutus-plutarch that contains the LambdaBuffers Plutus schema library generated by LambdaBuffers.
  6. +
  7. lbr-plutarch a Haskell runtime library necessary for working with lbf-xyz libraries.
  8. +
  9. lbf-prelude-plutarch that contains the LambdaBuffers Prelude schema library generated by LambdaBuffers.
  10. +
  11. lbf-plutus-plutarch that contains the LambdaBuffers Plutus schema library generated by LambdaBuffers.
-

Of course, additional imports for Plutarch libraries are also necessary plutarch and optionally plutarch-extra.

+

Of course, additional imports for Plutarch libraries are also necessary plutarch and optionally plutarch-extra.

For a full example see Example.

Inspecting the generated output

You can inspect the generated libraries using Nix:

@@ -549,10 +549,10 @@

Haskell modul import Plutarch.Api.V2 ()

    -
  1. LambdaBuffers.Plutus.V1.Plutarch is a module generated from Plutus.V1 LambdaBuffers schema and provided by the lbf-plutus-plutarch runtime library.
  2. -
  3. LambdaBuffers.Plutus.V2.Plutarch is a module generated from Plutus.V2 LambdaBuffers schema and provided by the lbf-plutus-plutarch runtime library.
  4. -
  5. LambdaBuffers.Prelude.Plutarch is a module generated from Prelude LambdaBuffers schema and provided by the lbf-prelude-plutarch runtime library.
  6. -
  7. LambdaBuffers.Runtime.Plutarch is a module provided by the lbr-plutarch runtime library.
  8. +
  9. LambdaBuffers.Plutus.V1.Plutarch is a module generated from Plutus.V1 LambdaBuffers schema and provided by the lbf-plutus-plutarch runtime library.
  10. +
  11. LambdaBuffers.Plutus.V2.Plutarch is a module generated from Plutus.V2 LambdaBuffers schema and provided by the lbf-plutus-plutarch runtime library.
  12. +
  13. LambdaBuffers.Prelude.Plutarch is a module generated from Prelude LambdaBuffers schema and provided by the lbf-prelude-plutarch runtime library.
  14. +
  15. LambdaBuffers.Runtime.Plutarch is a module provided by the lbr-plutarch runtime library.

Generated Plutarch module for a LambdaBuffers schema Foo/Bar.lbf (ie. Foo.Bar) is stored at Foo/Bar/Plutarch.hs

@@ -586,11 +586,11 @@

RestrictionsFor example the Foo record defined above would have no difference in Plutarch if it was defined as product Foo below:

prod Foo = Integer Bool
 
-

The Plutarch backend doesn't support the use of Char, Text, Bytes (there's a Plutus.V1.Bytes), Set and Map (there's a Plutus.V1.Map) from LambdaBuffers Prelude module.

+

The Plutarch backend doesn't support the use of Char, Text, Bytes (there's a Plutus.V1.Bytes), Set and Map (there's a Plutus.V1.Map) from LambdaBuffers Prelude module.

Plutarch

Type definition mapping

-

Plutarch backend supports all types from the LambdaBuffers Plutus schema library, as to enable full featured Plutus script development.

-

Additionally, it also supports some types from the LambdaBuffers Prelude schema library, namely Bool, Integer, Maybe, Either and List.

+

Plutarch backend supports all types from the LambdaBuffers Plutus schema library, as to enable full featured Plutus script development.

+

Additionally, it also supports some types from the LambdaBuffers Prelude schema library, namely Bool, Integer, Maybe, Either and List.

module Foo
 
 sum Sum = Some a | Nothing
@@ -714,7 +714,7 @@ 

PShow

All generated types have a PShow instance derived using the internal Plutarch deriving mechanism.

PShow serves to stringify Plutarch types which is very useful during debugging.

Example

-

Let work through the Plutarch example available in the repo.

+

Let work through the Plutarch example available in the repo.

First, please check the Getting started guide on how to prepare to work with the repo and setup Nix.

Let's see what we have here:

lambda-buffers/docs/plutarch ❯ find
@@ -731,8 +731,8 @@ 

Example

The salient bits we should focus on are:

    -
  1. The LambdaBuffers .lbf schema in ./api/Example.lbf that describes the API types used by our little program,
  2. -
  3. The Haskell Plutarch program in ./app/Example.hs that works with the API types.
  4. +
  5. The LambdaBuffers .lbf schema in ./api/Example.lbf that describes the API types used by our little program,
  6. +
  7. The Haskell Plutarch program in ./app/Example.hs that works with the API types.

To inspect the generated library:

lambda-buffers/docs/plutarch ❯ nix build .#lbf-plutarch-example-api
@@ -747,7 +747,7 @@ 

Example

The name of the generated library lbf-plutarch-example-api is set in the ./plutarch/build.nix Nix build file.

However, it's not expected for users to need to do this. If you have any issue please reach out.

-

Inspecting the Cabal file shows the standard runtime libraries we need:

+

Inspecting the Cabal file shows the standard runtime libraries we need:

lambda-buffers/docs/plutarch ❯ cabal info .
 * plutarch-example-0.1.0.0 (program)
     Synopsis:      LambdaBuffers Plutarch example
@@ -770,7 +770,7 @@ 

Example

lambda-buffers/docs/plutarch ❯ cabal run
 "Friends, peace and love!!!"
 
-

Take a look at the Example.hs to see how generated types are used, namely how they are constructed with pcon and deconstructed with pmatch (or pmatchC).

+

Take a look at the Example.hs to see how generated types are used, namely how they are constructed with pcon and deconstructed with pmatch (or pmatchC).

LambdaBuffers Design

The goal of the LambdaBuffers project is to enable software developers to specify their application types in a common format that can be conveniently diff --git a/purescript.html b/purescript.html index c2cb6bf9..17e300fb 100644 --- a/purescript.html +++ b/purescript.html @@ -157,7 +157,7 @@

Document.lbf schema

+

Let's now use lbf-prelude-to-purescript to process the Document.lbf schema

module Document
 
 -- Importing types