Monads are Monoids in the Category of Endofunctors - a Scala 3 Journey, No Psychobabble

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

ความคิดเห็น • 39

  • @user-fg6ng7ej6w
    @user-fg6ng7ej6w ปีที่แล้ว +1

    you are talented in explaining rather complex and abstract topics. all damn clear now... thanks

  • @Zubzub343
    @Zubzub343 3 ปีที่แล้ว +2

    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 !

    • @rockthejvm
      @rockthejvm  3 ปีที่แล้ว

      That's my goal with everything I teach.

  • @SuppressWarning
    @SuppressWarning 3 ปีที่แล้ว +1

    I love how you explain it in every pass in an abstract but practical way ♥️♥️

  • @michaele1373
    @michaele1373 3 ปีที่แล้ว +1

    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.

    • @rockthejvm
      @rockthejvm  3 ปีที่แล้ว

      This is how I approach all my videos and courses on FP, Cats, Spark, Akka, etc. More incoming

  • @alexandersviridov8682
    @alexandersviridov8682 3 ปีที่แล้ว +1

    Thank you. Best explanation ever.

  • @SevakAvet
    @SevakAvet 3 ปีที่แล้ว +1

    thanks for awesome videos! can't remember how many times I tried to understand this, you make things clear and much easier to understand!

    • @rockthejvm
      @rockthejvm  3 ปีที่แล้ว +1

      It means I'm doing my job well!

  • @TheMathmajki
    @TheMathmajki 3 ปีที่แล้ว +2

    I'm currently learning theory of category and this was helpful. Thanks

    • @rockthejvm
      @rockthejvm  3 ปีที่แล้ว

      Awesome, glad to hear it!

  • @teC5
    @teC5 3 ปีที่แล้ว +2

    amazing, enjoyed the method of working towards abstraction

  • @brians7100
    @brians7100 2 ปีที่แล้ว

    Proof by code. I love Scala. The fact it is able to do this is amazing

  • @jmgimeno
    @jmgimeno 3 ปีที่แล้ว +3

    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).

    • @rockthejvm
      @rockthejvm  3 ปีที่แล้ว +1

      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.

  • @PieterPrinsloo
    @PieterPrinsloo 2 ปีที่แล้ว

    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.

  • @Nebulorum
    @Nebulorum 3 ปีที่แล้ว +4

    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?

    • @rockthejvm
      @rockthejvm  3 ปีที่แล้ว

      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.

  • @seanhdr4k629
    @seanhdr4k629 3 ปีที่แล้ว +1

    I really like this video 😍 pressed the like button. more videos like this, please ❤️

  • @fulcanelly
    @fulcanelly 2 ปีที่แล้ว +1

    I think I can't think anymore

    • @rockthejvm
      @rockthejvm  2 ปีที่แล้ว

      😂 same here when I first learned this

  • @MrCesarification
    @MrCesarification ปีที่แล้ว +1

    Yes. Ooohhhhh yes. Hmmmm. I love it

  • @Sepph12
    @Sepph12 3 ปีที่แล้ว +1

    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?

    • @rockthejvm
      @rockthejvm  3 ปีที่แล้ว +1

      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.

    • @Sepph12
      @Sepph12 3 ปีที่แล้ว

      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 :)

  • @MrSmartiz77
    @MrSmartiz77 3 ปีที่แล้ว +2

    awesome !

    • @rockthejvm
      @rockthejvm  3 ปีที่แล้ว +1

      Glad you liked it!

  • @nerdwhisperer
    @nerdwhisperer 3 ปีที่แล้ว +1

    Wow, nice job.

    • @rockthejvm
      @rockthejvm  3 ปีที่แล้ว

      Glad you liked it!

  • @startstart7317
    @startstart7317 3 ปีที่แล้ว +1

    thanks you a lot!

  • @wuweifoundation
    @wuweifoundation ปีที่แล้ว

    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.

    • @rockthejvm
      @rockthejvm  ปีที่แล้ว

      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

  • @poyete
    @poyete 3 ปีที่แล้ว +2

    awesome

    • @rockthejvm
      @rockthejvm  3 ปีที่แล้ว +1

      Glad you liked it!