That is just amazing. You managed to fill the last few theoretical dark spots I had about this "problem" and at the same time you showed a complete practical implementation of it ! Congratulations, amazing work !
Amazing video. I like how methodical you went through the entire problem. I followed along and took a bunch of notes. I've intuitively understood it but never actually followed it through code and this was super super useful. Cheers and keep up the great videos.
A very nice explanation !!! Congratulations and thanks !!! I'm trying to replicate the same constructions you have done in Haskell and, to my surprise, its getting much more complex (or my knowledge of Haskell is not enough).
Glad you like it! Thankfully there are a lot more Haskell-based resources out there on the topic, as most category theory materials for programmers are almost always in Haskell.
Wait... I thought Monads are just another name for burritos. I will now have to stop ordering Monads for lunch. Jokes aside, great video, thanks for making this. I now have hope of understanding this after literally years of dabbling. Will have to rewatch a few times though but that is at least good for the view count.
My head is still spinning. However I really liked the way you abstracted away into higher and higher kinds. In had a colleague that tried to teach category theory and he was always saying we were too concrete and needed to abstract more. This video was a beautiful execution of abstractions. I wonder if the laws and properties should be mentioned? There was only one option to implement anything, but would that give the laws for free (say the structure forces it), or when implementing these things I should prove the properties?
The method definitions don't imply the laws. You can write an implementation of the Monad trait without obeying the monad laws. This is why I've skipped law enforcement.
43:38 - Implementing `flatten` - The reason you can pass `x => x` for `f: A => F[B]` is due to the `Id` type right? Could it be worth adding some details on how they fit together in the blog post?
It's not the Id. Look at the flatMap definition: You have a flatMap on F[F[A]], where the "value" is an F[A], let's call that Y. So you have a flatMap on F[Y], and a function from Y to F[A]. In our case Y is exactly F[A], so the function we pass to flatMap is F[A] => F[A], and I use x => x to do it.
Got it, x => x (in this case F[A] => F[A]) fits the A => F[B] type requirement if you replace A by F[A] and B by A. Still bends the mind a bit, but this was part of the disclosure :)
you are talented in explaining rather complex and abstract topics. all damn clear now... thanks
That is just amazing. You managed to fill the last few theoretical dark spots I had about this "problem" and at the same time you showed a complete practical implementation of it ! Congratulations, amazing work !
That's my goal with everything I teach.
I love how you explain it in every pass in an abstract but practical way ♥️♥️
Amazing video. I like how methodical you went through the entire problem. I followed along and took a bunch of notes. I've intuitively understood it but never actually followed it through code and this was super super useful. Cheers and keep up the great videos.
This is how I approach all my videos and courses on FP, Cats, Spark, Akka, etc. More incoming
Thank you. Best explanation ever.
thanks for awesome videos! can't remember how many times I tried to understand this, you make things clear and much easier to understand!
It means I'm doing my job well!
I'm currently learning theory of category and this was helpful. Thanks
Awesome, glad to hear it!
amazing, enjoyed the method of working towards abstraction
Thanks!
Proof by code. I love Scala. The fact it is able to do this is amazing
A very nice explanation !!! Congratulations and thanks !!! I'm trying to replicate the same constructions you have done in Haskell and, to my surprise, its getting much more complex (or my knowledge of Haskell is not enough).
Glad you like it! Thankfully there are a lot more Haskell-based resources out there on the topic, as most category theory materials for programmers are almost always in Haskell.
Wait... I thought Monads are just another name for burritos. I will now have to stop ordering Monads for lunch.
Jokes aside, great video, thanks for making this. I now have hope of understanding this after literally years of dabbling. Will have to rewatch a few times though but that is at least good for the view count.
My head is still spinning. However I really liked the way you abstracted away into higher and higher kinds. In had a colleague that tried to teach category theory and he was always saying we were too concrete and needed to abstract more. This video was a beautiful execution of abstractions. I wonder if the laws and properties should be mentioned? There was only one option to implement anything, but would that give the laws for free (say the structure forces it), or when implementing these things I should prove the properties?
The method definitions don't imply the laws. You can write an implementation of the Monad trait without obeying the monad laws. This is why I've skipped law enforcement.
I really like this video 😍 pressed the like button. more videos like this, please ❤️
More to come!
@@rockthejvm Yay!
I think I can't think anymore
😂 same here when I first learned this
Yes. Ooohhhhh yes. Hmmmm. I love it
43:38 - Implementing `flatten` - The reason you can pass `x => x` for `f: A => F[B]` is due to the `Id` type right? Could it be worth adding some details on how they fit together in the blog post?
It's not the Id. Look at the flatMap definition:
You have a flatMap on F[F[A]], where the "value" is an F[A], let's call that Y. So you have a flatMap on F[Y], and a function from Y to F[A]. In our case Y is exactly F[A], so the function we pass to flatMap is F[A] => F[A], and I use x => x to do it.
Got it, x => x (in this case F[A] => F[A]) fits the A => F[B] type requirement if you replace A by F[A] and B by A. Still bends the mind a bit, but this was part of the disclosure :)
awesome !
Glad you liked it!
Wow, nice job.
Glad you liked it!
thanks you a lot!
You're welcome!
Is there a Scala 2.13 version of the code you wrote with Scala 3 in this video? I would like to compare it with your Scala 3 version.
You'd just need to change the type lambda for a higher-kinded type with the kind projector plugin, otherwise it should still work fairly identical
awesome
Glad you liked it!