This advanced course will introduce you to the concept of monads in C++ and teach you how to implement and compose them. You will explore the design patterns functors, monads, and monad transformers, along with practical usage scenarios.
Overview
Syllabus
- Lesson 1: Dynamic Type Declaration in C++
- Use `auto` for Iterator in printVector Function
- Use `decltype` for Type Deduction
- Using std::is_same in Function Templates
- Multiply and Add with Dynamic Types
- Dynamic Type Declaration in Class Methods
- Apply Transform Function with Compile-Time Type Check
- Lesson 2: Optional values with std::optional
- Find Ingredient Amount
- Proper Handling of Empty Optional Values
- Finding the First Digit with std::optional
- Find the Maximum Negative Number using std::optional
- Lesson 3: Functor Design Pattern
- Transformer Functor for 2D Grids
- Create a Functor to Transform Strings in a Vector
- Using Functor to Transform Multiple Vectors
- Implement a Filtering Functor
- Lesson 4: Understanding Monads
- Implementing Operations with Logging
- Implementing a Functor for NumberWithLogs
- Implementing Monad with ValueWithLogs