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

Поділитися
Вставка
  • Опубліковано 23 січ 2025

КОМЕНТАРІ • 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 ♥️♥️

  • @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!

  • @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.

  • @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.

  • @TheMathmajki
    @TheMathmajki 3 роки тому +2

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

  • @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.

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

  • @teC5
    @teC5 3 роки тому +2

    amazing, enjoyed the method of working towards abstraction

  • @brians7100
    @brians7100 3 роки тому

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

  • @seanhdr4k629
    @seanhdr4k629 3 роки тому +1

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

  • @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

  • @PieterPrinsloo
    @PieterPrinsloo 3 роки тому

    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.

  • @MrSmartiz77
    @MrSmartiz77 3 роки тому +2

    awesome !

  • @fulcanelly
    @fulcanelly 3 роки тому +1

    I think I can't think anymore

    • @rockthejvm
      @rockthejvm  3 роки тому

      😂 same here when I first learned this

  • @nerdwhisperer
    @nerdwhisperer 3 роки тому +1

    Wow, nice job.

  • @startstart7317
    @startstart7317 3 роки тому +1

    thanks you a lot!

  • @poyete
    @poyete 3 роки тому +2

    awesome

  • @MrCesarification
    @MrCesarification Рік тому +1

    Yes. Ooohhhhh yes. Hmmmm. I love it