@@ -106,7 +106,7 @@ See the reference section for a full reference of `TxConstraint`.
106106- `script` is a phantom type parameter, just like in `TxConstraint `.
107107- `value` is the type of what this expression will resolve during runtime.
108108
109- `ConstraintDSL ` allows us to reference parts of the state machine's parameters,
109+ `ConstraintDSL ` allows us to reference parts of the state machine's parameters,
110110the current state, the transition arguments, and so forth.
111111
112112It also lets us perform checks (like equality) and apply transformations (like lifting a Plutarch function).
@@ -452,14 +452,14 @@ The following are lifted versions of Plutarch operators
452452
453453#### Setup: The Types
454454
455- First , we define a type to denote our script. It ’ s an uninhabited type , it can’ t be constructed.
455+ First , we define a type to denote our script. It ’ s an uninhabited type , it can’ t be constructed.
456456It ’ s only used as a tag for connecting all instances of type classes together.
457457
458458```haskell
459459data SimpleAuction
460460```
461461
462- We define a type for the read - only state of our script. This state can’ t be modified once created.
462+ We define a type for the read - only state of our script. This state can’ t be modified once created.
463463This becomes the `Params ` associated type of the `CEMScript ` type class.
464464
465465```haskell
@@ -507,8 +507,8 @@ data SimpleAuctionTransition
507507```
508508
509509We can now define an instance of the `CEMScriptTypes ` for `SimpleAuction `.
510- `CEMScriptTypes ` is a superclass of `CEMScript `, which just includes the associated types.
511- By defining the associated types separately, we can use the `deriveCEMAssociatedTypes`
510+ `CEMScriptTypes ` is a superclass of `CEMScript `, which just includes the associated types.
511+ By defining the associated types separately, we can use the `deriveCEMAssociatedTypes`
512512Template Haskell function to generate some boilerplate.
513513
514514```haskell
@@ -520,8 +520,8 @@ instance CEMScriptTypes SimpleAuction where
520520$ (deriveCEMAssociatedTypes False ''SimpleAuction)
521521```
522522
523- ` deriveCEMAssociatedTypes ` just executes ` derivePlutusSpine ` for all three of the associated types.
524- But it can only do that if all the members of a type have a ` HasPlutusSpine ` implementation.
523+ ` deriveCEMAssociatedTypes ` just executes ` derivePlutusSpine ` for all three of the associated types.
524+ But it can only do that if all the members of a type have a ` HasPlutusSpine ` implementation.
525525This is why we need to do ` derivePlutusSpine ` for the ` Bid ` type ourselves.
526526
527527The boolean argument to ` deriveCEMAssociatedTypes ` is unused for now, and it is recommended to use a value of ` False ` .
@@ -534,7 +534,7 @@ To implement the logic of our script, we define an instance of `CEMScript` for o
534534instance CEMScript SimpleAuction where
535535```
536536
537- We provide a value for ` compilationConfig ` , which at the moment contains
537+ We provide a value for ` compilationConfig ` , which at the moment contains
538538only a prefix for error codes to tell errors from different programs apart.
539539
540540``` haskell
@@ -661,3 +661,14 @@ Let’s examine each of the entries in the map in detail.
661661 ]
662662 )
663663 ```
664+
665+ ### Generating state diagram
666+
667+ Use `genCemGraph` function from `Cardano.CEM. Documentation ` module
668+ to produce `graphviz` definition:
669+
670+ ```bash
671+ $ cabal repl cem- script- example
672+ ghci> : m + System. IO Cardano. CEM CEM.Example. Auction Data. Proxy
673+ ghci> withFile " auction_diagram.dot" WriteMode (\ h -> hPutStrLn h (genCemGraph " CEM Simple Acutoin" (Proxy :: Proxy SimpleAuction )))
674+ ```
0 commit comments