Skip to content

Commit

Permalink
Update gh-pages
Browse files Browse the repository at this point in the history
Store path: /nix/store/9q75zrlxjyggdhkhkwwx7dj0mw646ffx-lambda-buffers-book
  • Loading branch information
hercules-ci[bot] committed Nov 21, 2023
1 parent d548e1d commit 93b8427
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion getting-started.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ <h2 id="building-and-development"><a class="header" href="#building-and-developm
shellcheck...........................................(no files to check)Skipped
typos....................................................................Passed
</code></pre>
<p>To run all the code quality tooling specified in the <a href="../pre-commit.nix">pre-commit-check config file</a></p>
<p>To run all the code quality tooling specified in the <a href="https://github.com/mlabs-haskell/lambda-buffers/blob/main/pre-commit.nix">pre-commit-check config file</a></p>

</main>

Expand Down
2 changes: 1 addition & 1 deletion haskell.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ <h1 id="lambdabuffers-to-haskell"><a class="header" href="#lambdabuffers-to-hask
</code></pre>
<p>Or we can simply just refer directly to the <code>lbf-prelude-to-haskell</code> CLI by <code>nix run github:mlabs-haskell/lambda-buffers#lbf-prelude-to-haskell</code>.</p>
<p>In this chapter, we're going to use the latter option.</p>
<p>Let's now use <code>lbf-prelude-to-haskell</code> to process the <a href="examples/Document.lbf">Document.lbf</a> schema.</p>
<p>Let's now use <code>lbf-prelude-to-haskell</code> to process the <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/docs/examples/Document.lbf">Document.lbf</a> schema.</p>
<pre><code class="language-purescript">module Document

-- Importing types
Expand Down
40 changes: 20 additions & 20 deletions plutarch.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,19 @@ <h1 id="lambdabuffers-for-plutarch"><a class="header" href="#lambdabuffers-for-p
<h2 id="lambdabuffers-modules"><a class="header" href="#lambdabuffers-modules">LambdaBuffers modules</a></h2>
<p>Writing .lbf schemas with API types intended for Plutarch backend will typically use the following LambdaBuffers schema modules:</p>
<ol>
<li><a href="../libs/lbf-prelude/Prelude.lbf">Prelude</a>,</li>
<li><a href="../libs/lbf-plutus/Plutus/V1.lbf">Plutus.V1</a>,</li>
<li><a href="../libs/lbf-plutus/Plutus/V2.lbf">Plutus.V2</a>.</li>
<li><a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-prelude/Prelude.lbf">Prelude</a>,</li>
<li><a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-plutus/Plutus/V1.lbf">Plutus.V1</a>,</li>
<li><a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-plutus/Plutus/V2.lbf">Plutus.V2</a>.</li>
</ol>
<p>Take a look at <a href="./plutarch/api/Example.lbf">Example.lbf</a> schema as an example.</p>
<p>Take a look at <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/docs/plutarch/api/Example.lbf">Example.lbf</a> schema as an example.</p>
<h2 id="haskell-libraries"><a class="header" href="#haskell-libraries">Haskell libraries</a></h2>
<p>The necessary LambdaBuffers runtime libraries a typical Plutarch project needs when working with LambdaBuffers:</p>
<ol>
<li><a href="../runtimes/haskell/lbr-plutarch">lbr-plutarch</a> a Haskell runtime library necessary for working with <code>lbf-xyz</code> libraries.</li>
<li><a href="../libs/lbf-prelude">lbf-prelude-plutarch</a> that contains the <a href="../libs/lbf-prelude">LambdaBuffers Prelude</a> schema library generated by LambdaBuffers.</li>
<li><a href="../libs/lbf-plutus">lbf-plutus-plutarch</a> that contains the <a href="../libs/lbf-plutus">LambdaBuffers Plutus</a> schema library generated by LambdaBuffers.</li>
<li><a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/runtimes/haskell/lbr-plutarch">lbr-plutarch</a> a Haskell runtime library necessary for working with <code>lbf-xyz</code> libraries.</li>
<li><a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-prelude">lbf-prelude-plutarch</a> that contains the <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-prelude">LambdaBuffers Prelude</a> schema library generated by LambdaBuffers.</li>
<li><a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-plutus">lbf-plutus-plutarch</a> that contains the <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-plutus">LambdaBuffers Plutus</a> schema library generated by LambdaBuffers.</li>
</ol>
<p>Of course, additional imports for Plutarch libraries are also necessary <a href="https://github.com/Plutonomicon/plutarch-plutus">plutarch</a> and optionally <a href="https://github.com/Plutonomicon/plutarch-plutus/plutarch-extra">plutarch-extra</a>.</p>
<p>Of course, additional imports for Plutarch libraries are also necessary <a href="https://github.com/Plutonomicon/plutarch-plutus">plutarch</a> and optionally <a href="https://github.com/Plutonomicon/plutarch-plutus/tree/master/plutarch-extra">plutarch-extra</a>.</p>
<p>For a full example see <a href="#example">Example</a>.</p>
<h3 id="inspecting-the-generated-output"><a class="header" href="#inspecting-the-generated-output">Inspecting the generated output</a></h3>
<p>You can inspect the generated libraries using Nix:</p>
Expand Down Expand Up @@ -225,10 +225,10 @@ <h2 id="haskell-modules"><a class="header" href="#haskell-modules">Haskell modul
import Plutarch.Api.V2 ()
</code></pre>
<ol>
<li>LambdaBuffers.Plutus.V1.Plutarch is a module generated from <a href="../libs/lbf-plutus/Plutus/V1.lbf">Plutus.V1</a> LambdaBuffers schema and provided by the <a href="../libs/lbf-plutus">lbf-plutus-plutarch</a> runtime library.</li>
<li>LambdaBuffers.Plutus.V2.Plutarch is a module generated from <a href="../libs/lbf-plutus/Plutus/V2.lbf">Plutus.V2</a> LambdaBuffers schema and provided by the <a href="../libs/lbf-plutus">lbf-plutus-plutarch</a> runtime library.</li>
<li>LambdaBuffers.Prelude.Plutarch is a module generated from <a href="../libs/lbf-prelude/Prelude.lbf">Prelude</a> LambdaBuffers schema and provided by the <a href="../libs/lbf-prelude">lbf-prelude-plutarch</a> runtime library.</li>
<li>LambdaBuffers.Runtime.Plutarch is a module provided by the <a href="../runtimes/haskell/lbr-plutarch">lbr-plutarch</a> runtime library.</li>
<li>LambdaBuffers.Plutus.V1.Plutarch is a module generated from <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-plutus/Plutus/V1.lbf">Plutus.V1</a> LambdaBuffers schema and provided by the <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-plutus">lbf-plutus-plutarch</a> runtime library.</li>
<li>LambdaBuffers.Plutus.V2.Plutarch is a module generated from <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-plutus/Plutus/V2.lbf">Plutus.V2</a> LambdaBuffers schema and provided by the <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-plutus">lbf-plutus-plutarch</a> runtime library.</li>
<li>LambdaBuffers.Prelude.Plutarch is a module generated from <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-prelude/Prelude.lbf">Prelude</a> LambdaBuffers schema and provided by the <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-prelude">lbf-prelude-plutarch</a> runtime library.</li>
<li>LambdaBuffers.Runtime.Plutarch is a module provided by the <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/runtimes/haskell/lbr-plutarch">lbr-plutarch</a> runtime library.</li>
</ol>
<blockquote>
<p>Generated Plutarch module for a LambdaBuffers schema <code>Foo/Bar.lbf</code> (ie. <code>Foo.Bar</code>) is stored at <code>Foo/Bar/Plutarch.hs</code></p>
Expand Down Expand Up @@ -262,11 +262,11 @@ <h2 id="restrictions"><a class="header" href="#restrictions">Restrictions</a></h
<p>For example the <code>Foo</code> record defined above would have no difference in Plutarch if it was defined as product <code>Foo</code> below:</p>
<pre><code class="language-lbf">prod Foo = Integer Bool
</code></pre>
<p>The Plutarch backend doesn't support the use of <code>Char</code>, <code>Text</code>, <code>Bytes</code> (there's a Plutus.V1.Bytes), <code>Set</code> and <code>Map</code> (there's a Plutus.V1.Map) from <a href="../libs/lbf-prelude/Prelude.lbf">LambdaBuffers Prelude</a> module.</p>
<p>The Plutarch backend doesn't support the use of <code>Char</code>, <code>Text</code>, <code>Bytes</code> (there's a Plutus.V1.Bytes), <code>Set</code> and <code>Map</code> (there's a Plutus.V1.Map) from <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-prelude/Prelude.lbf">LambdaBuffers Prelude</a> module.</p>
<h2 id="plutarch"><a class="header" href="#plutarch">Plutarch</a></h2>
<h3 id="type-definition-mapping"><a class="header" href="#type-definition-mapping">Type definition mapping</a></h3>
<p>Plutarch backend supports all types from the <a href="../libs/lbf-plutus">LambdaBuffers Plutus</a> schema library, as to enable full featured Plutus script development.</p>
<p>Additionally, it also supports some types from the <a href="../libs/lbf-prelude">LambdaBuffers Prelude</a> schema library, namely <code>Bool</code>, <code>Integer</code>, <code>Maybe</code>, <code>Either</code> and <code>List</code>.</p>
<p>Plutarch backend supports all types from the <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-plutus">LambdaBuffers Plutus</a> schema library, as to enable full featured Plutus script development.</p>
<p>Additionally, it also supports some types from the <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/libs/lbf-prelude">LambdaBuffers Prelude</a> schema library, namely <code>Bool</code>, <code>Integer</code>, <code>Maybe</code>, <code>Either</code> and <code>List</code>.</p>
<pre><code class="language-lbf">module Foo

sum Sum = Some a | Nothing
Expand Down Expand Up @@ -390,7 +390,7 @@ <h4 id="pshow"><a class="header" href="#pshow">PShow</a></h4>
<p>All generated types have a PShow instance derived using the internal Plutarch deriving mechanism.</p>
<p><a href="https://github.com/Plutonomicon/plutarch-plutus/blob/c14ad83479706566fe22e7b7b50b696043326c8f/Plutarch/Show.hs#L52">PShow</a> serves to stringify Plutarch types which is very useful during debugging.</p>
<h2 id="example"><a class="header" href="#example">Example</a></h2>
<p>Let work through the <a href="./plutarch">Plutarch example</a> available in the repo.</p>
<p>Let work through the <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/docs/plutarch">Plutarch example</a> available in the repo.</p>
<p>First, please check the <a href="getting-started.html">Getting started</a> guide on how to prepare to work with the repo and setup Nix.</p>
<p>Let's see what we have here:</p>
<pre><code class="language-shell">lambda-buffers/docs/plutarch ❯ find
Expand All @@ -407,8 +407,8 @@ <h2 id="example"><a class="header" href="#example">Example</a></h2>
</code></pre>
<p>The salient bits we should focus on are:</p>
<ol>
<li>The LambdaBuffers .lbf schema in <a href="./plutarch/api/Example.lbf">./api/Example.lbf</a> that describes the API types used by our little program,</li>
<li>The Haskell Plutarch program in <a href="./plutarch/app/Example.hs">./app/Example.hs</a> that works with the API types.</li>
<li>The LambdaBuffers .lbf schema in <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/docs/plutarch/api/Example.lbf">./api/Example.lbf</a> that describes the API types used by our little program,</li>
<li>The Haskell Plutarch program in <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/docs/plutarch/app/Example.hs">./app/Example.hs</a> that works with the API types.</li>
</ol>
<p>To inspect the generated library:</p>
<pre><code class="language-shell">lambda-buffers/docs/plutarch ❯ nix build .#lbf-plutarch-example-api
Expand All @@ -423,7 +423,7 @@ <h2 id="example"><a class="header" href="#example">Example</a></h2>
<p>The name of the generated library <code>lbf-plutarch-example-api</code> is set in the ./plutarch/build.nix Nix build file.</p>
</blockquote>
<p>However, it's not expected for users to need to do this. If you have any issue please reach out.</p>
<p>Inspecting the <a href="./plutarch/plutarch-example.cabal">Cabal file</a> shows the standard runtime libraries we need:</p>
<p>Inspecting the <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/docs/plutarch/plutarch-example.cabal">Cabal file</a> shows the standard runtime libraries we need:</p>
<pre><code class="language-shell">lambda-buffers/docs/plutarch ❯ cabal info .
* plutarch-example-0.1.0.0 (program)
Synopsis: LambdaBuffers Plutarch example
Expand All @@ -446,7 +446,7 @@ <h2 id="example"><a class="header" href="#example">Example</a></h2>
<pre><code class="language-shell">lambda-buffers/docs/plutarch ❯ cabal run
&quot;Friends, peace and love!!!&quot;
</code></pre>
<p>Take a look at the <a href="./plutarch/app/Example.hs">Example.hs</a> to see how generated types are used, namely how they are constructed with <code>pcon</code> and deconstructed with <code>pmatch</code> (or <code>pmatchC</code>).</p>
<p>Take a look at the <a href="https://github.com/mlabs-haskell/lambda-buffers/tree/main/docs/plutarch/app/Example.hs">Example.hs</a> to see how generated types are used, namely how they are constructed with <code>pcon</code> and deconstructed with <code>pmatch</code> (or <code>pmatchC</code>).</p>

</main>

Expand Down
Loading

0 comments on commit 93b8427

Please sign in to comment.