You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plutarch.md
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -44,8 +44,8 @@ For a full example see [Example](#example).
44
44
Writing .lbf schemas with API types intended for Plutarch backend will typically use the following LambdaBuffers modules:
45
45
46
46
1.[Prelude](../libs/lbf-prelude/Prelude.lbf),
47
-
1.[Plutus.V1](../libs/lbf-plutus/Plutus/V1.lbf),
48
-
2.[Plutus.V2](../libs/lbf-plutus/Plutus/V2.lbf).
47
+
2.[Plutus.V1](../libs/lbf-plutus/Plutus/V1.lbf),
48
+
3.[Plutus.V2](../libs/lbf-plutus/Plutus/V2.lbf).
49
49
50
50
Take a look at [Example.lbf](./plutarch/api/Example.lbf) schema as an example.
51
51
@@ -99,16 +99,16 @@ import Plutarch.Api.V1 ()
99
99
importPlutarch.Api.V2 ()
100
100
```
101
101
102
-
1.[LambdaBuffers.Plutus.V1.Plutarch]() is a module generated from [Plutus.V1](../libs/lbf-plutus/Plutus/V1.lbf) LambdaBuffers schema and provided by the [lbf-plutus-plutarch](../libs/lbf-plutus) runtime library.
103
-
2.[LambdaBuffers.Plutus.V2.Plutarch]() is a module generated from [Plutus.V2](../libs/lbf-plutus/Plutus/V2.lbf) LambdaBuffers schema and provided by the [lbf-plutus-plutarch](../libs/lbf-plutus) runtime library.
104
-
3.[LambdaBuffers.Prelude.Plutarch]() is a module generated from [Prelude](../libs/lbf-prelude/Prelude.lbf) LambdaBuffers schema and provided by the [lbf-prelude-plutarch](../libs/lbf-prelude) runtime library.
105
-
3. [LambdaBuffers.Runtime.Plutarch]() is a module provided by the [lbr-plutarch](../runtimes/haskell/lbr-plutarch) runtime library.
102
+
1.LambdaBuffers.Plutus.V1.Plutarch is a module generated from [Plutus.V1](../libs/lbf-plutus/Plutus/V1.lbf) LambdaBuffers schema and provided by the [lbf-plutus-plutarch](../libs/lbf-plutus) runtime library.
103
+
2.LambdaBuffers.Plutus.V2.Plutarch is a module generated from [Plutus.V2](../libs/lbf-plutus/Plutus/V2.lbf) LambdaBuffers schema and provided by the [lbf-plutus-plutarch](../libs/lbf-plutus) runtime library.
104
+
3.LambdaBuffers.Prelude.Plutarch is a module generated from [Prelude](../libs/lbf-prelude/Prelude.lbf) LambdaBuffers schema and provided by the [lbf-prelude-plutarch](../libs/lbf-prelude) runtime library.
105
+
4.LambdaBuffers.Runtime.Plutarch is a module provided by the [lbr-plutarch](../runtimes/haskell/lbr-plutarch) runtime library.
106
106
107
107
>GeneratedPlutarch module for a LambdaBuffers schema `Foo/Bar.lbf` (ie. `Foo.Bar`) is stored at `Foo/Bar/Plutarch.hs`
108
108
109
109
## Restrictions
110
110
111
-
Plutarch backend doesn't support recursive type definitions unfortunatelly (see #131).
111
+
Plutarch backend doesn't support recursive type definitions unfortunately (see #131).
112
112
113
113
The following will not work:
114
114
@@ -153,9 +153,9 @@ The Plutarch backend doesn't support the use of `Char`, `Text`, `Bytes` (there's
153
153
154
154
### Type definition mapping
155
155
156
-
Plutarch backend support all types from the LambdaBuffers Plutus module, as to enable full featured Plutus script development.
156
+
Plutarch backend supports all types from the LambdaBuffers Plutus module, as to enable full featured Plutus script development.
157
157
158
-
Additionally, it also support some types from the LambdaBuffers Prelude module, namely `Bool`, `Integer`, `Maybe`, `Either` and `List`.
158
+
Additionally, it also supports some types from the LambdaBuffers Prelude module, namely `Bool`, `Integer`, `Maybe`, `Either` and `List`.
159
159
160
160
```lbf
161
161
module Foo
@@ -203,7 +203,7 @@ data Product (a :: PType) (s :: Plutarch.S) = Product (Plutarch.Term s (Plutarch
203
203
204
204
### Type class implementations
205
205
206
-
Plutarch has a couple of fundamental classes essential to its operations namely, `PlutusType`, `PIsData`, `PTryFrom` and `PEq`.
206
+
Plutarch has a couple of fundamental typeclasses essential to its operations namely, `PlutusType`, `PIsData`, `PTryFrom` and `PEq`.
207
207
208
208
#### PlutusType
209
209
@@ -232,7 +232,7 @@ It's important to note that there's a subtle but important distinction to be mad
232
232
This means that `pmatch'` should never error, andif it does that means the implementation is wrong.
233
233
`ptryFrom` is different, as it takes some `PData` and tries to parse it into a `PType`, but can fail.
234
234
235
-
However, inLambdaBuffers, both of these methods follow the exact same logicpattern, and they correspond and can be generated using the `from Plutusdata` specification.
235
+
However, inLambdaBuffers, both of these methods follow the exact same logicalpattern, and they correspond and can be generated using the `from Plutusdata` specification.
236
236
237
237
#### PTryFrom
238
238
@@ -254,7 +254,7 @@ class PSubtype a b => PTryFrom (a :: PType) (b :: PType) where
254
254
There's some additionally features exhibited by this type class, most noteworthy is the `PTryFromExcess` type family that enables us specify the part of the structure that wasn't parsed and is left unexamined.
255
255
It's a form of optimization that becomes very important if you have a very complex data type such as `ScriptContext` from the `plutus-ledger-api`.
256
256
257
-
Apparently, a good intuition pump for the this 'excess' business is that of a [zipper](https://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/huet-zipper.pdf).
257
+
Apparently, a good intuition pump for this 'excess' business is that of a [zipper](https://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/huet-zipper.pdf).
258
258
We focus on a certain part of a data structure, only ever providing links to other parts that are left un-examined.
259
259
260
260
LambdaBuffers doesn't use this feature and sets the `PTryFromExcess` to a unit type, signaling that nothing is left unexamined.
@@ -263,7 +263,7 @@ LambdaBuffers doesn't use this feature and sets the `PTryFromExcess` to a unit t
263
263
264
264
Printing an implementation for this class for a particular type is governed by `derive Plutus.V1.PlutusData <type>` statements in .lbf schemas.
265
265
266
-
[PIsData](https://github.com/Plutonomicon/plutarch-plutus/blob/c14ad83479706566fe22e7b7b50b696043326c8f/Plutarch/Builtin.hs#L354) serves to track 'is it plutus data encoded?' with types.
266
+
[PIsData](https://github.com/Plutonomicon/plutarch-plutus/blob/c14ad83479706566fe22e7b7b50b696043326c8f/Plutarch/Builtin.hs#L354) serves to track 'is it Plutus data encoded?' with types.
0 commit comments