Skip to content

Commit 0549068

Browse files
committed
Applied Jared's suggestions and fixed pre-commit errors
1 parent 60fbdac commit 0549068

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

docs/plutarch.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ For a full example see [Example](#example).
4444
Writing .lbf schemas with API types intended for Plutarch backend will typically use the following LambdaBuffers modules:
4545

4646
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).
4949

5050
Take a look at [Example.lbf](./plutarch/api/Example.lbf) schema as an example.
5151

@@ -99,16 +99,16 @@ import Plutarch.Api.V1 ()
9999
import Plutarch.Api.V2 ()
100100
```
101101

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.
106106

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

109109
## Restrictions
110110

111-
Plutarch backend doesn't support recursive type definitions unfortunatelly (see #131).
111+
Plutarch backend doesn't support recursive type definitions unfortunately (see #131).
112112

113113
The following will not work:
114114

@@ -153,9 +153,9 @@ The Plutarch backend doesn't support the use of `Char`, `Text`, `Bytes` (there's
153153

154154
### Type definition mapping
155155

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.
157157

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`.
159159

160160
```lbf
161161
module Foo
@@ -203,7 +203,7 @@ data Product (a :: PType) (s :: Plutarch.S) = Product (Plutarch.Term s (Plutarch
203203

204204
### Type class implementations
205205

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 type classes essential to its operations namely, `PlutusType`, `PIsData`, `PTryFrom` and `PEq`.
207207

208208
#### PlutusType
209209

@@ -232,7 +232,7 @@ It's important to note that there's a subtle but important distinction to be mad
232232
This means that `pmatch'` should never error, and if it does that means the implementation is wrong.
233233
`ptryFrom` is different, as it takes some `PData` and tries to parse it into a `PType`, but can fail.
234234

235-
However, in LambdaBuffers, both of these methods follow the exact same logic pattern, and they correspond and can be generated using the `from Plutus data` specification.
235+
However, in LambdaBuffers, both of these methods follow the exact same logical pattern, and they correspond and can be generated using the `from Plutus data` specification.
236236

237237
#### PTryFrom
238238

@@ -254,7 +254,7 @@ class PSubtype a b => PTryFrom (a :: PType) (b :: PType) where
254254
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.
255255
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`.
256256

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).
258258
We focus on a certain part of a data structure, only ever providing links to other parts that are left un-examined.
259259

260260
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
263263

264264
Printing an implementation for this class for a particular type is governed by `derive Plutus.V1.PlutusData <type>` statements in .lbf schemas.
265265

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.
267267

268268
```haskell
269269
newtype PAsData (a :: PType) (s :: S) = PAsData (Term s a)
@@ -355,7 +355,7 @@ autogen/LambdaBuffers/Example
355355
autogen/LambdaBuffers/Example/Plutarch.hs
356356
```
357357

358-
> The name of the generated library `lbf-plutarch-example-api` is set in the [Nix build file][./plutarch/build.nix#L67].
358+
> The name of the generated library `lbf-plutarch-example-api` is set in the ./plutarch/build.nix Nix build file.
359359
360360
However, it's not expected for users to need to do this. If you have any issue please reach out.
361361

docs/plutarch/build.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
exactDeps = true;
4242

43-
nativeBuildInputs = config.settings.shell.tools ++ [config.packages.lbf-plutus-to-plutarch];
43+
nativeBuildInputs = config.settings.shell.tools ++ [ config.packages.lbf-plutus-to-plutarch ];
4444

4545
tools = {
4646
cabal = { };

docs/plutarch/plutarch-example.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ common common-language
8282
default-language: Haskell2010
8383

8484
executable plutarch-example
85-
import: common-language
85+
import: common-language
8686
build-depends:
8787
, base >=4.16
8888
, lbf-plutarch-example-api
@@ -93,5 +93,5 @@ executable plutarch-example
9393
, plutarch-extra
9494
, text >=1.2
9595

96-
hs-source-dirs: app
97-
main-is: Example.hs
96+
hs-source-dirs: app
97+
main-is: Example.hs

0 commit comments

Comments
 (0)