This commit is contained in:
Alexander Navarro 2024-10-20 22:20:02 -03:00
parent c620e6b14a
commit 76c7956d21
5 changed files with 67 additions and 7 deletions

View file

@ -1,22 +1,25 @@
# Monad Is Actually Easy.
# Monad Is Actually Easy
![rw-book-cover](https://i.ytimg.com/vi/8hYUthfmSRM/maxresdefault.jpg)
## Metadata
- Author: [[Coding with Yalco]]
- Full Title: Monad Is Actually Easy.
- Category: #articles
- Document Tags: [[dev]] [[dev/design-patterns]]
- URL: https://www.youtube.com/watch?v=8hYUthfmSRM
- Archive: https://web-archive.alecodes.page/bookmarks?bf=1&search=&title=Monad%20Is%20Actually%20Easy.
- Document Tags: [[dev]] [[dev/design-patterns]]
- URL: <https://www.youtube.com/watch?v=8hYUthfmSRM>
- Archive: <https://web-archive.alecodes.page/bookmarks?bf=1&search=&title=Monad%20Is%20Actually%20Easy>.
> [!tldr]
> #Functional #Programming #Coding
This video explains one of the concepts of functional programming, Monad. A monad can be understood as a box that creates a new box filled with values by applying a function to a value. The basic functions of a monad include Unit, Map, and FlatMap. The unit is a function that wraps a given value in a monad, Map is a function that sends out the result of the executed function back into the box, and FlatMap is a function that processes values already contained in the box. Thanks to these functions, monads make it convenient to process values in programming and help simplify difficult problems. Therefore, understanding and being able to use it is a great help in improving programming skills. Through this video, I hope you have helped understand the basic concepts and operating principles of Monad, and understand Monad through a simple example.
## Highlights
'Maybe' is like Schrödinger's box.  In other words, it is used to hold a value that  may or may not exist, just like the types called   Option, Optional, Nullable in other languages. Such monads allow for the safe and convenient  
handling of operations when a  valid value has not been returned [View Highlight](https://read.readwise.io/read/01j9xkp05a5hvjysk36jj8qt2x)) [[resources]]
handling of operations when a  valid value has not been returned [View Highlight](https://read.readwise.io/read/01j9xkp05a5hvjysk36jj8qt2x)) [[resources]]
> [!note]
> This example can be usefull to replicate the behavior of Option<T> of Rust in other languages
@ -35,6 +38,5 @@ the Left Unit Law. When there's a certain value and a function,  the rule is th
the Right  Unit Law which stipulates that,  the result of applying a function that  simply returns the same value to the monad  should be identical to the original monad. [View Highlight](https://read.readwise.io/read/01j9xk7rpfgzvd8ba29cx9qj44))
he law of associativity. 
he law of associativity.
When applying two functions  'f' and 'g' to a certain monad,  Applying 'g' to the result of first applying 'f', Should yield the same result as applying a single   function that is a combination  of 'f' and 'g' sequentially. [View Highlight](https://read.readwise.io/read/01j9xk96vz0xb9wm1vkmke4ser))