Ok the usefullness of this wasnt making any sense to me until we started using nullable types. Maybe JS wasn't the best langauge to explain these concepts with? The pattern seems to be much more relevant to other languages like C# to me
my hobby: spreading lies about functional programming "Monads are just functions which take one argument. They always explain it in a really complicated way."
4:23 Way to turn a perfectly readable `n * n` to obfuscated code. I would hate to debug your code. Would've been better to create *separate functions* for stringifying what was done. Something like var n = 5 log(beganwith(x)) log(added(x,1,(y = add(x,1)))) log(squared(y,(z = square(y)))) log(multiplied(z,3,multiply(z,3))) would be far less confusing to read. since it doesn't create additional lines of code in functions that should kept to just one task so that they can be inlined by any compiler that's used instead of an interpreter
If i'm seeing this right, it looks like a technique to bind operations that don't want to know about the all parts of a data structure to only the parts it wants to know about, in a way that's easy to extend both on the supported functions, and the underlying data structure. And then the broader secret work clicked
feels like a glorified version of wrapper pattern, or rebuilding object-oriented design in a function language without using class (new NumberWithLogs(5).add(5).square() ?). the secret work-behind-the-scene sometimes can be confusing either, because hiding the null protections, the function name not indicating it, the later readers must be familiar with the library or they won't know certain behaviours actually happen from the code. Hiding certain behaviours to ease things out - that also sound like what classes are for, and don't get me wrong, same issue also happens in object-oriented languages. We usually need to think a fitting name for things or write good documentations to avoid that. This video kinda ignored such aspect - codes are more for reading. It also results in repeating code, using monads in the way of first example. The code's theme should be about calculations, but reading the final product, it seems more about runWithLogs().
I thought typescript is just an attempt to fake a type system badly over javascript a non functional language. Why the heck are you talking about monads? Theres no monads in javascript lol.
_CAP_ is actually *PAC* "In case of *Partition* you can choose between *Availability* or *Consistency* but not both." *CAPELC* is the full reality: "In case of *Partition* you can choose between *Availability* or *Consistency* but not both. *Else* (when not partitioned), choose between *Latency* and *Consistency* "
Bro, you're a legend. I've tried at least a dozen times before this to learn about monads. Wikipedia, googling, videos... was always left with the feeling that even though I didn't get it, the explanations were all trash. This video is so clear, I immediately understood the concept and how it was useful. And some old examples of monads that still rattled around in the skull suddenly made a lot more sense. Thank you.
At 8:37, the very first line of getPetNickname calls getCurrentUser. If getCurrentUser returns a User of None, do the other lines in getPetNickname execute as well?
I think maybe in more professional and critical software this could be important, but as a game dev I watch this and think "wow this is very overcomplicated"
Seems there are libraries around bringing monads and other FP features to JS but they are NOT good for bringing in real production work with teams for many reasons.
i watch a lot of videos on monads and they always focus on the generic aspect of the monad wrapper, but really this video nails behavior aspects which is what really matters. you can even write monadic code in C using this examples and still have great value using it.
I don’t do a ton of programming with my job but I’ve just started a project that requires me to write a code that needs to handle a bunch of undefined data and I was wondering the best way to do that was, lucky I stumbled across this video in a perfect coincidence
This video perfectly answers the questions I had. The techniques are described clearly and concisely. I've got to write this down. Thanks for the video!