This is an overview of lecture 4 in the Plutus Pioneer Program: https://www.youtube.com/watch?v=6Reuh0xZDjY
Lecture 4 covered a large amount of new ideas. So much that we will unpack it in 2 parts. In part 1, we will look at the first 1.5 hours of the lecture where we will walkthrough the code examples.
Specifically we will be looking at the Maybe and Either type. Then we will look at implementing a new Writer type.
Finally we will look at Monad’s and see how the above types can be defined as Monads.
One particular topic that was convered was the bind function of a Monad. I wish I clarified in the video, but what bind does is it:
“…takes a monadic value and a function that can transform the value, and returns a new monadic value.”
I only cover the topics in context of the code that was went thorugh the lecture and don’t do the topic justice. Please refer to these other helpful resources to understand Monads:
Plutus Pioneer Github Repo: https://github.com/input-output-hk/plutus-pioneer-program
00:00 – Intro
00:39 – Side Effects
02:31 – IO
03:30 – Underlying IO implementation
04:43 – Maybe
08:46 – Maybe simplified code
17:14 – Either
21:48 – Either simplified code
26:08 – Custom Writer class
30:42 – Writer simplified code
39:29 – Monad definition
41:13 – Monad bind function
42:13 – Monad Benefits
44:56 – Creating a generic monad helper function
49:11 – Conclusion