Hiya! It turns out that what is described in this video is the Functor and not the Monad. The difference between these two is quite minor so I'll leave it here. A monad is just a functor which has some extra property within the bind method. Functions being passed in bind calls must have as their return types an instance of the monad being used. The bind method of a monad would then need to "unwrap" that value.
@wanderingthewastes61592 жыл бұрын
Wait, so I’m using a monad everytime I call .unwrap() in Rust?
@AByteofCode2 жыл бұрын
@@wanderingthewastes6159 I would need to look into it but from the little I know, unwrap is a method of an Option type, which I believe is a monad. You would need to ask someone who knows more about rust than me, I've only seen like 2-3 No Boilerplate videos.
@felixnderitu14552 жыл бұрын
Hey can you do a full Video about Design patterns ?
@mskiptr2 жыл бұрын
No, no, no! What you described here *are* properties of a typical _monad_ (barring some technicalities). _Functors_ are things you can write a _map_ function for, such as _lists_ (applies the function to every element inside), but also _maybe_ (apply the function if there is something inside).
@nxone99032 жыл бұрын
a monad is just a monoid in the category of endofunctors
@falkelh2 жыл бұрын
I already know what a monad is: it's that thing that my annoying friend who's just learned Haskell won't stop talking about
@AByteofCode2 жыл бұрын
Sounds about right :)
@andrasfogarasi50142 жыл бұрын
A monad is just a monoid in the category of endofunctors. I don't know what people don't get about that.
@AByteofCode2 жыл бұрын
Hehe... Just wait a few weeks and I'll have a full video about that sentence (and all the CT necessary to understand it)
@oscareriksson94142 жыл бұрын
Yes. That is thing I understand.. endofunkting easy! 😁
@Brunoenribeiro2 жыл бұрын
"bart, say the line!"
@AByteofCode2 жыл бұрын
@@Brunoenribeiro im tempted to ask stemg for his permission to use that clip in a video lmao
@arsnakehert2 жыл бұрын
@@AByteofCode Subscribed to wait for it lol
@crabbyboi91272 жыл бұрын
I'm a big fan of the "fireship style" of videos and it's great to see more people creating high quality content like this
@AByteofCode2 жыл бұрын
It's about time the style leaves web development and talks about other stuff :)
@yt-13372 жыл бұрын
@@AByteofCode exactly
@4xmo2 жыл бұрын
why is that in quotes lol
@dailyfunnytv358 Жыл бұрын
@@4xmo because he's not the creator
@Yazan_Majdalawi Жыл бұрын
This channel is much better at this "style" than fireship, this one is much clearer, fireship's vids are a mess
@tylerscott92772 жыл бұрын
This 2 minute video is a better explanation of monads than some hour long lecture I've watched. Really good stuff!
@AByteofCode2 жыл бұрын
Thanks for the kind words! Honestly those lectures are good but too long to focus on so they end up not being good. Lectures are also generally performed in front of a group of students with assumed knowledge basics. I wrote this video with no pre-requisites other than knowing a tiny bit of programming.
@samuelwaller49242 жыл бұрын
You may be very small now, but with this quality of content you will definitely be big one day!
@AByteofCode2 жыл бұрын
Thanks for the kind words and optimism!
@9paradox2 жыл бұрын
i approve this comment.
@hydralisk982 жыл бұрын
I approve this sentiment. The video content is high quality already and I support such efforts much. I can't wait to see what is next from "A Byte of Code", especially as a hobby programmer interested much in both past and future tech advances.
@AByteofCode2 жыл бұрын
@@hydralisk98 Ever heard of JSF*ck? :p
@hydralisk982 жыл бұрын
@@AByteofCode You mean the JS implementation of Brainf*ck? Not the JS edition before this video but yes I am aware of it. I do am aware of much as far as my curiosity lead me to, both in esoteric prog langs and more serious ones like Common Lisp, C# and even exploring F#/F*. Hopefully as I dive into the history of web tech (going before even SGML & IBM's GML), we may collaborate on advanced programming functional structures soon. ^*^//
@tsyf12 жыл бұрын
Fireship's influence shows. You're also just as talented at explaining complex things in a short time.
@AByteofCode2 жыл бұрын
I started this channel in part to further the Fireship style to other realms of programming, so that is actually a great compliment, thank you!
@DavidSimonTetruashvili2 жыл бұрын
And it's a great style. Imitating it, I think, will only bring good things as it mutates through creators picking it up. Also, refreshing to see this style without the usual inside jokes fireship includes in his fast-pace videos which can sometimes be misconstrued as facts...
@AByteofCode2 жыл бұрын
@@DavidSimonTetruashvili I agree fireship has an amazing way of showcasing content and that its a good place to start out from and develop one's own style off of it. Was expecting to have more time to adapt but youtube's algorithm did not agree. I watch a lot of fireship but can't think of any of these inside jokes off the top of my head, would you have an example or two by any chance?
@tsyf12 жыл бұрын
@@DavidSimonTetruashvili I was thinking the same thing. It'll be very interesting watching this style evolve.
@miquelvazquez45442 жыл бұрын
@@AByteofCode he usually uses irony! stuff along the lines (off the top of my head, not exact quote) of: "we all love getting a new framework every month"
@gilmoretj Жыл бұрын
This has to be the best explanation of Monads I have found out of all the many, many, many videos I have watched, and definitely the most productive 2 minutes and 30 second - highly recommended. I suspect one of the major difficulties with explaining the concept are the different mindsets of the audience from the instructor. The vast majority of instructors will be from a declarative/Functional Programming background where solutions are defined in terms of what needs to be done. The audience will largely comprise developers from an imperative OOP/Procedural background where solutions are formed by defining the steps required to resolve the problem. Having an explanation in terms of how the monad resolves a problem by absorbing some of the steps is really easy to understand. The last 60 seconds of this video really hits that message home, but I would not go as far as to suggest watching the video in reverse.
@AByteofCode Жыл бұрын
Thank you!! The second paragraph is definitively key to what made this video work. When I made it, my understanding of functional programming was pretty mediocre, making it no more than an imperative programmer trying to explain monads to other imperative programmers. However I never actually realized what I had done until this comment, so thanks for pointing it out :)
@swankitydankity2972 жыл бұрын
I commend you for having so clearly and accessibly explained a notoriously difficult topic. I finally feel like I actually understand what these are now. Thanks!
@AByteofCode2 жыл бұрын
Ayo glad to help!
@robinmoussu2 жыл бұрын
That’s probably the best concise explanation of monad I’ve read so far!
@AByteofCode2 жыл бұрын
I'm happy to hear that!
@benjaminshu40182 жыл бұрын
Great video±! You have enlightened my vision on computer science by finally explaining to me what a monad is dude.
@AByteofCode2 жыл бұрын
lmao
@polycode26882 жыл бұрын
These videos are well made, keep making them!
@AByteofCode2 жыл бұрын
Glad you like them, I definitively will continue!
@DanielRamBeats2 жыл бұрын
There have been many attempts to explain monads and many have failed but your example makes it extremely clear, thank you
@AByteofCode2 жыл бұрын
I'm happy to help :)
@AByteofCode2 жыл бұрын
What can I do to make my future videos better? Any feedback (even negative) is much appreciated!
@brian-bed2 жыл бұрын
remember to pin your comments so i can see then at the top :)
@AByteofCode2 жыл бұрын
@@brian-bed oh right yeah lol ty for pointing that out
@sharbelokzan96732 жыл бұрын
I still don't understand monads 100%, But this video is where I can say I got the closest to understand them. And the most surprising thing is the video length! I have watched, before this, a lot of other videos about monads, and some of them were really long and thorough, but I consider this one is the best so far. I can't be sure whether it's the example you gave or the fact that I'm watching this after watching many similar videos, but this is defiantly QUALITY CONTENT, short, concise, holistic and well-narrate. Thankyou very much
@AByteofCode2 жыл бұрын
This brings a smile to my face :) If you don't plan on going into functional programming, just think of monads as a smart box that does stuff to its contents for you. (Its more than that but the distinction doesn't matter outside of FP)
@sharbelokzan96732 жыл бұрын
@@AByteofCode tnx!, yup I think the smart box analogy do it for me now
@AByteofCode2 жыл бұрын
@@sharbelokzan9673 Ayy that's good to hear! Was considering using that analogy for the video itself but decided to avoid using metaphors
@taragnor Жыл бұрын
Yeah this is the most concise explanation of a monad I've seen and in a way that a regular programmer would understand.
@tantalus_complex Жыл бұрын
@@AByteofCode Question for you. I see the Maybe monad example in this video as a way of relocating many examples of a problematic procedural step ("procedural" in the normal English sense) down to a single isolated location. As a result, common problems stemming from that step (in this case, problems with function calls and property accessors) can be handled in common. I have an example which I think fits this pattern, and therefore might be a monad. Is there a term for a monad which relocates side effects, like state updates/assignment or DOM renders, in much the same way that you relocate function calls and property accessors?
@sanketower2 жыл бұрын
The best Monad explanation I've seen so far.
@AByteofCode2 жыл бұрын
Glad to hear that!!!
@leshommesdupilly Жыл бұрын
Wow, that was a very clear explanation ! Now I know how useful monads are. Unfortunately, I already forgot what they are.
@uselessDev7 ай бұрын
Most clear and concise explanation of monads that I've seen - amazing stuff
@thorodinson39292 жыл бұрын
To the point, concise and clear explanation. Just what a developer needs.
@charleshughes14172 жыл бұрын
This is the most comprehensible explanation of monads I've come across. Thanks.
@AByteofCode2 жыл бұрын
That is very nice to hear :) You're welcome!
@RamiGB2 жыл бұрын
Being a functor or a monad doesn't matter you've done a brilliant video in a beautiful way that would hopefully inspire newer developers to be better, respect to you
@AByteofCode2 жыл бұрын
Reading this gives me the happy :) Thank you for the kind words!
@ElliottParkinson2 жыл бұрын
Insane quality of content for a channel so small. You've earned my subscription
@AByteofCode2 жыл бұрын
Thank you! I'm glad you enjoyed this video that was uploaded to a 30 sub channel :)
@babyboie202 жыл бұрын
Holy crap, this is super useful and a way of thinking that I haven’t thought of before. Nice work!
@AByteofCode2 жыл бұрын
Glad I could be helpful! Thanks for the kind words :)
@txzk26 Жыл бұрын
This is the most clear and intuitive explanation of monad I ever had. Thanks
@sunofabeach9424 Жыл бұрын
I love how monads are explained with such example that fights JS absurdity
@hello-world1 Жыл бұрын
what is wrong with JS? In fact, it is in JS that this problem can be solved with using optional chaining which keep the code readable and debuggable at the same time.
@sunofabeach9424 Жыл бұрын
@@hello-world1 chaining is doable in every language that supports OOP. And don't get me started with JS wrongs...
@hello-world1 Жыл бұрын
@@sunofabeach9424 not chaining, optional chaining meaning that if you put .. then the program won't throw if the prop can't be accessed. ok get started let's hear.
@sunofabeach9424 Жыл бұрын
@@hello-world1 ah, I checked what this "?." does. The one thing it can do is just short-circ evaluation. While it is useful at times, it does not let you bind a callback function or manipulate the object this callback is attached to. It is not nearly as powerful as a monad. It's funny that this "?." serves one purpose - to make null-checks more compact, while nulls shouldn't be a thing in the first place
@SirSidi Жыл бұрын
I love you. I was referred to a 12 mins video about monads, I watched all of it and I swear I had no idea what it was talking about. I got the clear idea of what monads are in 2 short minutes.
@AByteofCode Жыл бұрын
Glad to hear that!
@erin15692 жыл бұрын
I didn't expect such quality from a ~350 sub channel The sound got much better compared to older videos (I think you got a little bit more confident) I'll make sure to share your channel with some of my friends to help you grow :)
@AByteofCode2 жыл бұрын
Hehe and I had 30 subs when I posted that video :) Also thanks for the kind words and help, I appreciate it!
@proloycodes2 жыл бұрын
almost 3k subs in just 4 days, so yeah this channel is gonna blow up
@AByteofCode2 жыл бұрын
@@proloycodes That would be a certified pog moment :) If my current growth rate continues for a week I'll be at 10k. In any case, I have a couple of videos planned out that I suspect might check the same boxes as monads do so that might be helpful too. As someone who was hoping for 100 subs by the end of the summer, all of this is absolutely insane!
@torarinvik49202 жыл бұрын
Hands down the best explanation of Monads I have seen on youtube.
@AByteofCode2 жыл бұрын
Ty for the kind words!
@torarinvik49202 жыл бұрын
@@AByteofCode my pleasure!
@Jordan4Ibanez2 жыл бұрын
You're a gem, my friend. Keep up the great work!
@AByteofCode2 жыл бұрын
Thanks for the kind words!
@brqnet2 жыл бұрын
I am glad that I found this channel, I love to learn something new like algorithms and complex information rather than seeing basic stuff and useless tutorials,. Keep it up man
@AByteofCode2 жыл бұрын
Thanks for the kind words :)
@TheonlyNonlethalninja2 жыл бұрын
Much has improved from the last video! Personally I think mellow background music would help relieve any pauses and there's a rlly quiet but somewhat noticeable static noise when you're talking
@AByteofCode2 жыл бұрын
Ty! Audio is a sharp corner I never seem to get right but someday...
@TheonlyNonlethalninja2 жыл бұрын
@@AByteofCode it is hard personally I just upgraded to the blue yeti x it's $170 but has its own processing software and it's a night and day difference if you watch my C video compared to wifi
@AByteofCode2 жыл бұрын
@@TheonlyNonlethalninja Oh lol I have a blue yeti, i should probably look up how to make it do better audio
@TheonlyNonlethalninja2 жыл бұрын
@@AByteofCode oh then something is off lol should be an easy fix if you're using the blue yeti software while recording
@AByteofCode2 жыл бұрын
@@TheonlyNonlethalninja That would seem to be the part I'm missing! I'll look into getting the blue yeti software I was not aware existed.
@flippert0 Жыл бұрын
Whoa, sifted through a lot of Haskell literature and was none the wiser. Thanks for the succinct explanation.
@AByteofCode Жыл бұрын
Glad it was helpful!
@noodle-eater2 жыл бұрын
This is interesting first time hearing about monad, pretty interesting to try
@AByteofCode2 жыл бұрын
Good luck with that! I'm glad I saved someone from spending 12 hours watching random youtube videos trying to understand lol
@CyperN0772 жыл бұрын
I absolutely love that your video is very readable. A lot of content creators make content that's unwatchable unless you're a freakin' eagle.
@AByteofCode2 жыл бұрын
The benefit of spending a whole month on a single video :)
@Jebusankel2 жыл бұрын
Doesn't a Monad also need a flatmap to collapse your nested Maybes down to one level?
@AByteofCode2 жыл бұрын
Usually, in list monads, the bind method is called flatMap. If you're planning on nesting Maybes than you could change the "extra logic" to take care of it. Having a flatMap isn't required so I omitted it to not overcomplicate anything
@mskiptr2 жыл бұрын
Well, you can already do that with just bind: flatten : Monad m => m (m a) -> m a flatten x = bind x id -- This is the type of bind I assumed here: -- bind : Monad m => m a -> (a -> m b) -> m b id : a -> a id x = x
@AByteofCode2 жыл бұрын
@@mskiptr You have a problem. You try explaining it with haskell. Now you have two problems :p I think this guy does javascript and is used to the monadic "bind" for lists being called flatMap, whereas the functorial "bind" for lists is just map.
@mskiptr2 жыл бұрын
lol alright, I'll try to explain it in JavaScript. If you have an _Array_ of _Arrays,_ you can flatten it to just one level with only a clever use of bind (which is the same as flatMap in this case) - no need for a special un-nesting function: [[0,1],[2,3]].flatMap(x => x) = [0,1,2,3] And it works the exact same way with _Maybe,_ as well as with anything else that properly implements its bind function.
@nonadqs2 жыл бұрын
Yes! This guy described a functor, flatMap would usually just be ".bind(x => x)", but it always return a new instance of the value instead just returning the function. You can think of a Functor as anything that implements ".map", like arrays, and monads are anything that implement flatMap. The Maybe interface here isn't powerful enough for implementing flatMap (at least not the functional one, you can do a unsafe trick with the value property).
@hannaandersson44762 жыл бұрын
The best explanation I've seen so far, yet by far the shortest too. Great work!
@nkiett38052 жыл бұрын
A star is born! Great content mate, the quality, time, clarity, visualizing are just so right. I rarely subscribe after watching a few vids (but given that you only have 4 at the moment 😉), but you got my sub. Keep up the awesome work mate!
@AByteofCode2 жыл бұрын
Thanks for the kind words! I'll try my best lol
@jeremiahreilly9739 Жыл бұрын
Thank you. I still don't understand monads, but this is the very first video which gives me hope that I might understand monads one day.
@AByteofCode Жыл бұрын
You can do it :)
@carlospedroza26042 жыл бұрын
Loving all your videos! I'd love more about functional programming!
@AByteofCode2 жыл бұрын
omg ty! I have a few other FP videos planned so stay tuned for those :D
@champion31762 жыл бұрын
You are an excellent instructor. I will stick with you.
@AByteofCode2 жыл бұрын
Thank you!
@o_enamuel2 жыл бұрын
0:02 5x5 = 15
@AByteofCode2 жыл бұрын
I really messed up something that simple lmfaoo Great catch tho!
@redsunschan53212 жыл бұрын
This video is more like a text book to teach how to make people subscribe in 2.5mins Informative, clear, interactive expression Instant subscribed
@AByteofCode2 жыл бұрын
This comment is music to my ears! And considering the view to sub conversion rate I think you're right :)
@rchaykovskiy2 жыл бұрын
0:38 Usually you wouldn‘t do it that way, you used nested if-statements which is ugly, instead use unnested guard-clauses : if (userObject == null) return null; let userFriends = userObject.friends if (userFriends == null) return null; let firstFriend = userFriends.first() if (firstFriend == null) return null; Instead of returning null you can also throw or if we‘re talking about WebAPI then return a JSON object containing error message or something like that
@AByteofCode2 жыл бұрын
Shhhhh totally wasn't taking the worst way to do something to prove a point lmao. I'd thought of putting it like that and honestly if you don't have monads that's a pretty good way of doing it.
@daleryanaldover65452 жыл бұрын
your content is fresh and I don't see this type of content anywhere else, subbed!
@AByteofCode2 жыл бұрын
Thanks for the kind words and the sub! I'll try my best to keep the content going :)
@PavltheRobot2 жыл бұрын
Very valuable tutorial, concise and clear.
@AByteofCode2 жыл бұрын
Thanks for the kind words!
@ky3ow2 жыл бұрын
Actually the most understandable explanation and nearly the fastest, didn't expect that from such small channel, keep it up)
@AByteofCode2 жыл бұрын
Fun fact I had 30 subs when I posted that video :) Thanks for the kind words, I'll definitively keep it up!
@randomguy86472 жыл бұрын
You're very underrated
@AByteofCode2 жыл бұрын
Thanks for the kind words!
@proloycodes2 жыл бұрын
agree
@Euquila2 жыл бұрын
After years of visiting this topic, I finally get it. Thanks!
@AByteofCode2 жыл бұрын
Glad it helped! :)
@arisweedler4703 Жыл бұрын
This is so incredible. So simple understandable and clear. Well done!!
@AByteofCode Жыл бұрын
Thanks for the kind words :)
@badmanjones1792 жыл бұрын
this video is so good that im pissed. this concept is literally so simple and yet all the "explanations" existing online are like "hey buddy youre gonna need a computer philosophy degree for this" and then explain nothing. but like this + your clarifying comment make crystal clear sense. im so pissed. great work
@AByteofCode2 жыл бұрын
Thank you!! The way I see it, monads are SO simple that the phd nerds think that if you don't understand, you're an idiot and so they use complicated examples. Another common pitfall is the whole "explain it in haskell" thing, where if you can understand haskell, you probably know monads already.
@muhammademirsyah80372 жыл бұрын
Wow the quality of this content is just unbelievable, keep it going
@AByteofCode2 жыл бұрын
That is music to my ears! Thanks for the kind words!
@nomoredarts8918 Жыл бұрын
In 2 minutes you explain concept that everyone else can't explain in 20 minutes or more!
@hpph17442 жыл бұрын
Best explaining Monad ever.
@AByteofCode2 жыл бұрын
:) Thanks for the kind words!
@5cover Жыл бұрын
God-tier explanation, extremely concise and easy to understand. Thank you!
@AByteofCode Жыл бұрын
Thanks for the kind words!!
@possumkeys Жыл бұрын
Wow, such a short video but better than the 10 to 14 minute videos I've watched. Well done.
@AByteofCode Жыл бұрын
Thank you!
@69k_gold Жыл бұрын
Very short and sweet explanation! I like how you explained concisely the reason to use monads and how they basically work
@AByteofCode Жыл бұрын
Glad it was helpful!
@YashKumar-it5fr2 жыл бұрын
first channel that i subscried after only wathing one video . Amazing content.
@AByteofCode2 жыл бұрын
Ayyyy glad to hear that and thanks for the kind words!
@anandpbgupta2 жыл бұрын
This is best explanation ever I got about Monad or Functor for that matter!
@AByteofCode2 жыл бұрын
Thanks for the kind words!
@3_14pie7 ай бұрын
After watching this video again after months and others of countless explanations + category theory, I think I'm finally beginning to get it
@AByteofCode7 ай бұрын
Glad to hear that!
@DiamondSaberYT8 күн бұрын
That’s basically Optional in Java. Love it! :D Nice explanation
@darwinschuppan8624 Жыл бұрын
Not even 3 minutes, straight to the point and had me saying "oooohhhhh, no f*cking way it was this simple" at the end. 10/10 video
@AByteofCode Жыл бұрын
Thanks for the kind words!
@rebeccakeller46662 жыл бұрын
Amazing. Thank you for explaining, so simply and concisely, what many many other videos and blogs have failed to get into my head
@AByteofCode2 жыл бұрын
:) I am very happy to have been able to help!
@ChocolateMilkCultLeader2 жыл бұрын
Amazing content. Will share this with my NL audience. I'm sure you will blow up
@AByteofCode2 жыл бұрын
Thank you my man!
@eboubaker37222 жыл бұрын
Finallyyy i understood it, computerphile video was complicated for me, your small example was really easy to understand
@AByteofCode2 жыл бұрын
The computerphile video was the first one I saw while researching the topic. I'm gonna go rewatch it see if it makes more sense now. It's a shame that video appears first under the search term monad when all it does is complicate things
@a8lg6p Жыл бұрын
This is the first explanation I've heard that makes sense.
@AByteofCode Жыл бұрын
:)
@aidenlilley13192 жыл бұрын
This is the best explanation I have ever heard thank you
@AByteofCode2 жыл бұрын
Your welcome and thanks for the kind words!
@Dht1kna2 жыл бұрын
Finally understood why I would want a monad
@MightyElemental Жыл бұрын
I studied haskell during my computer science degree, but this is the first time I've actually understood what a monad is.
@sophieAutumnMay2 жыл бұрын
Very good video; all killer, no filler.
@AByteofCode2 жыл бұрын
Hehe that's the goal! Thanks for the kind words :)
@asimssheikh2 жыл бұрын
Wow. Finally understood this concept. You have talent. Keep going.
@AByteofCode2 жыл бұрын
Glad to hear that :)
@rituchandra63252 жыл бұрын
Such a simple and precise explanation... wow, 100% immediate sub, please keep up the nice work!
@AByteofCode2 жыл бұрын
Will do! Glad you enjoyed :)
@johnphillips46592 жыл бұрын
Very cool, much impressed! Glad to have found your channel.
@AByteofCode2 жыл бұрын
Thank you! I'm also glad you found my channel :)
@thanatosor2 жыл бұрын
I would prefer how F# or ML way to explain this as “function composition”, for chaining functions together in a correct types order like a factory. Just that simple. In Rust, it use Option so most of time you need to unwrap, but it also can help compose functions with “.” Operator. Which is very convenient and less confusing to people.
@AByteofCode2 жыл бұрын
I think for OOP users, the dot operator would be quite confusing. There are many ways to explain and the idea of function composition is a pretty good alternative, I mean, I was thinking of using that for this video but thought the pipeline idea would be more intuitive for my target audience of OOP devs
@thanatosor2 жыл бұрын
@@AByteofCode would be great if you gather all those languages and compare them in doing this feature. Fsharp, Ocaml, Haskell, Rust, Ruby, even JS … ha ha
@AByteofCode2 жыл бұрын
@@thanatosor Hmm. Not sure what point we'd be trying to prove there. Monads, outside of complex stuff like Promises, aren't really suitable for anything OOP. I just used javascript in this video because my focus was on people just knowing what the word meant and using a language which actually uses monads would have added too much obscurity to be understandable
@thanatosor2 жыл бұрын
@@AByteofCode to my latest comment, it’s just my idea, since I tend to make the same thing in different languages. Nothing more to prove I guess. Not a big fan of JS but I admit that it’s everywhere now.
@AByteofCode2 жыл бұрын
@@thanatosor Yeah I'm not a big fan of JS (python supremacy) just forced into using it by circumstance (and in videos because everyone knows it so nothing to explain). I guess it could be interesting to have a repertoire of what certain patterns look like in different languages, you're right.
@massimo8408 Жыл бұрын
Wow, I have been developing for 7 years, and I did not know about this, very cool!
@AByteofCode Жыл бұрын
Learn something every day!
@amerjabar78252 жыл бұрын
A really great video! I hope your success as a KZbinr comes soon.
@AByteofCode2 жыл бұрын
Thanks for the optimism!
@pro100tom2 жыл бұрын
Thank you very much for the explanation. I've got a question. At 1:20 should it return "Maybe: with a null value instead of "this"?
@AByteofCode2 жыл бұрын
That would also work, but in functional programming, the only requirement is not modifying existing data, so returning the current instance of the monad complies with the rules of FP. When "return this" appears, you already know "this" contains a null.
@commissarsydian41252 жыл бұрын
Dude, that was amazing. I would only recommend saving for a better audio setup but I trust that is a long term goal.
@AByteofCode2 жыл бұрын
A better audio setup is more of a short term goal :) I literally just got monetized a few minutes ago and all of the revenue from that is gonna be going towards improving audio quality, until people stop complaining about it xD
@wojciechwilimowski985 Жыл бұрын
I've spent a few hours reading Mark Seemann's blog to first understand the concept, turns out I could have just watched a 3 minute youtube video instead 😂 Excellent
@AByteofCode Жыл бұрын
:D
@leonardobagi93532 жыл бұрын
Now yes, a decent quality video. Keep up the good work man!
@AByteofCode2 жыл бұрын
Thanks, will do!
@kieronkoh42302 жыл бұрын
Bro u gonna be big one day. Can't wait for more of such videos
@AByteofCode2 жыл бұрын
That would be very cool. If you have any specific topics you'd be interested in, don't hesitate to tell me!
@vicnicius20092 жыл бұрын
That video is awesome, congrats for the great content!
@AByteofCode2 жыл бұрын
Thank you for the kind words!
@lilshoe10002 жыл бұрын
So excited to see what comes next with ur channel, keep up the great work :)
@AByteofCode2 жыл бұрын
What an interesting coincidence, I'm also excited to see what comes next!
@glenospace2 жыл бұрын
Pretty great explanation. Thanks. Would love the video to be longer with more examples.
@AByteofCode2 жыл бұрын
Thank you!! I have a monad video planned about the category theory definition and a massive functional programming one which'll mention a multitude of monads. But considering the success of the topic, I could definitively see myself make a dedicated video about a ton of different monad types.
@SrIgort2 жыл бұрын
Please continue posting these "How do X work/What is X", it's very interesting! :D
@AByteofCode2 жыл бұрын
Will absolutely do! Any specific X's you'd wanna hear about?
@samgarg52282 жыл бұрын
So much info in ~3 minutes, great 🔥
@AByteofCode2 жыл бұрын
Eyyyy :D
@Ben-cq4db Жыл бұрын
Subscribed at 12.7k! See you at a million in just a bit.
@AByteofCode Жыл бұрын
Thanks for the kind words!
@th34lch3m1st2 жыл бұрын
Devastating synthesis, straight to the point. Subscribed.
@AByteofCode2 жыл бұрын
Hearing that gives me the happy :)
@Sam-pn6gb2 жыл бұрын
Next big programming channel 💪
@AByteofCode2 жыл бұрын
:D That'd be cool ngl
@cccccc8642 жыл бұрын
Great video. Easy to follow with beautiful graphics. Thanks. :)
@AByteofCode2 жыл бұрын
Thanks for the kind words :) Glad you enjoyed!
@thatsalot35772 жыл бұрын
Finally an actual explanation of a monad.
@AByteofCode2 жыл бұрын
The ironic thing is the video is technically inaccurate, it describes the Endofunctor. For it to be a Monad, the function passed into .bind would need to return an instance of the Monad in question. Although, if you're not a functional programmer, the difference doesn't really matter and since noone knows the nuance, you can still use endofunctors and claim it to be a monad :p
@thatsalot35772 жыл бұрын
@@AByteofCode nah I really didn't know much about monads I'm just a simple webdev who makes games in part time But that pattern looked much familiar to promises
@AByteofCode2 жыл бұрын
@@thatsalot3577 Turns out Javascript promises ARE monads! They were designed like that I believe.
@ExylonBotOfficial2 жыл бұрын
This is the best explanation ever
@AByteofCode2 жыл бұрын
Aww thank you!
@streetchronicles56932 жыл бұрын
strong, powerful, simple, great video
@AByteofCode2 жыл бұрын
Thank you!
@loctite4172 жыл бұрын
Love that this video isnt a 2 second video saying "a monad is just a monoid in the category of endofunctors" and actually explains the concept in a practical way
@AByteofCode2 жыл бұрын
I love that video "what is a monad" where its just a robot reading all the different dictionary definitions and none of them make any sense whatsoever (even talking about non programming uses of monad)
@willd46862 жыл бұрын
Can the return value of the function passed to bind be a different type than the original value?
@AByteofCode2 жыл бұрын
As far as I know, of course! What matters is the type of the box, not its contents :) Some hardcore functional programming fanatics might disagree but do what you see fit with the patterns you have!
@willd46862 жыл бұрын
@@AByteofCode That makes sense, thanks for the video. Its really helped my understanding
@avi122 жыл бұрын
You just described Promises without using the word Promise Nicely done
@AByteofCode2 жыл бұрын
:) Hehe true, Promises are Monads
@jonathanlalande30902 жыл бұрын
Really good explanation for a 2:30 minutes video!
@AByteofCode2 жыл бұрын
Glad to hear that! (Or is it a good explanation _because_ its 2:30 long and thus without bloat?)
@DreySF2 жыл бұрын
I can only support what others are saying. Good content. You have my sub 😁. I love the fireship style and target audience.
@AByteofCode2 жыл бұрын
Ty :D I'm glad you enjoy!
@noelgomile36756 ай бұрын
In your JavaScript example, why didn't you make use of the null aware operator to safely access potentially null properties?
@AByteofCode5 ай бұрын
I put the code in javascript since its very readable even to non javascript programmers, but you are right in that the null safety operator is better for this specific use case :)
@MatteoAntonyMistretta2 жыл бұрын
Good explanation, although wouldn't this particular use case be solved by just wrapping the whole code block in a try-catch statement?
@AByteofCode2 жыл бұрын
Lol, Spoken like a true non FP dev! I mean yes, that would do the trick. Personally, I like to avoid try catches if there is any other way of doing it. Also, that would work to handle this specific case, but if your "extra processing" becomes something a bit more complex, there won't be any easy solution like that.
@MatteoAntonyMistretta2 жыл бұрын
@@AByteofCode well I am a functional programmer but monads is where I draw the line. Between an async function and a Promise I prefer an async function whenever I can. Also, creating a Maybe class sounds even less functional to me
@adicardrz2 жыл бұрын
Easy, to the point explanation, subbed, looking forward to new videos!
@AByteofCode2 жыл бұрын
Ay thanks! Any specific topics you'd be interested in?