Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
## Lecture 2 notes | ||
|
||
1) Get started with the cabal repl | ||
|
||
Since we are not installing cabal locally, bacause it is much more convenient to use it from nix-shell (this is included in nix), we will navigate to the plutus-pioneer/week02 git-cloned repo inside a nix environment. However, nix must be started first from the plutus root repo. | ||
|
||
$ cd Cardano-King/plutus/ | ||
$ nix-shell | ||
nix$ cd ../plutus-pioneer-program/code/week02 | ||
nix$ cabal repl | ||
|
||
Now we are isnide the cabal repl (takes a while the first time). Time to test some varaibles defined in the plutus libraries | ||
|
||
repl$ import PlutusTx | ||
|
||
Some examples seeing the type of Data and create bite-string on the fly (use literal strings to create byte strings), and then test it (:t B ...) | ||
|
||
repl$ :i Data | ||
repl$ :set -XOverloadedStrings ## allows to include extremely large strings (literal-string to byte-strings) | ||
repl$ :t B "Haskellanians" | ||
|
||
## --------------------------------------------------------------------------------------- | ||
2) Implement our first validator. Start a Haskell module "Week02.Gift" where the script imports all the necessary language extensions that plutus needs. (first 8 lines `{-#...#-}`) and other modules that we refer to (lines 12-28) from the `./week01/EnglishAuction.hs` script. | ||
|
||
Go back to the repl and load Gift.hs. Then we will see what a Monoid in haskell `()` | ||
|
||
repl$ :l ./src/Week02/Gift.hs | ||
repl$ :t () | ||
|
||
We can open Gift.hs in a text editor and see that lines 31-35 contain the implementation of Monoid | ||
|
||
|