A Monads Approach for Beginners, in Scala | Rock the JVM

preview_player
Показать описание

This video is for Scala programmers with some essential skills (generics, Options and how flatMap works on lists). In here, I'll try to arrive at the monad structure by writing code and solving programming problems, instead of weird mexican-food analogies or blackboard abstract math.

Monads are inherently abstract, but we'll write concrete examples, and then derive the structure of a monad and the monad properties ("laws") starting from the concrete and then generalizing the ideas. We'll write some 150 lines of code in this video alone.

Contents:
0:00 Intro and requirements
1:00 The ETW pattern and monad structure
10:50 Example 1: a census application
17:05 Example 2: async calls in an online store
24:51 Example 3: double-for "loops"
28:28 The monad properties

Follow Rock the JVM on:

-------------------------------------------------------------------------
-------------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

One of the best Monad laws I've ever seen. Very nice man!

politrons
Автор

I have read articles and books, cried tears of blood while going thru them. And then I find this.. Wow -- well done. If your courses are like this.. I am a buyer for sure. Keep up the excellent work.

ketanpurohit
Автор

Bravo!!! There are no bad students, just incompetent teachers. I am proud to say I CAME ACROSS THE BEST TEACHER!!! Kudos to you Daniel :)

rohanurkude
Автор

Absolutely best description/explanation I have seen! It "clicked"

michaelreuter
Автор

Such a brilliant explanation. Thank you very much!

daqo
Автор

This video FINALLY made me understand HOW to use monads!

sagnikbhattacharya
Автор

You've got talent for keeping watcher's attention through whole 40min video :) Thanks for great content!

ernestbednarczyk
Автор

I liked very much that you skipped the theory and stick to the behavior of the code, you can always read more about the theory if you want but explanations like this with demostration on the the terminal, I think is what is most valuable for this video. Keep up the good work! and thank you very much!

slim_mike
Автор

Thanks Daniel, really appreciate, I'm studying Cats right now but this video was very clear and helpful!

LucaSavoja
Автор

The first time I watch the video, I still didn't understand Monads. But, in the second, I got it.

Thank you!

tungtranvan
Автор

I am so happy I went through this video. 40 mins felt a bit too much, but I guess it was required to understand. Thanks a lot.

ivanvelikanova
Автор

Great video explaining a topic that often gets beginners confused.

I would add that most developers have used monads in some way without knowing the underlying concept:
- async/await especial syntax is kind of the same as 'for comprehension' but specialized for async code. Instead of using 'await' you use '<-' in Haskell or Scala
- Null coalescing/chaining especial syntax is the same but specialized for null / Optionals. Instead of operators like '.?', ':?' and '??' you use '<-', again.
- Nested for loops don't have special syntax AFAIK, but this is just because it's usually not an issue. If it were, we would probably have some other special syntax in mainstream languages.

This uniformity makes it a lot easier to learn and understand in the long run, because you use the same abstraction over and over again instead of adding complexity to the language (new operators, special syntax, function keywords, etc). This composes better and, imho, it's a lot more elegant.

valcron-
Автор

I really learned a lot from this vid! Thanks! I’m not a Scala dev but I think I can use that new flatMap approach when working with Stream API from Java 8!

kawaiicare
Автор

Very clearly explained. The examples used are good for helping me understand the concept. Thank you very much!

rmiliming
Автор

done lots of haskell a while back but never heard of the 'm-word', gonna embrace it :-)

paveltroev
Автор

thank you, I read cats book, too hard to understand, but I got all after watching your video.

ggsgetafaf
Автор

I've heard that Monad has one more property - anyone who got understanding Monad immediately looses ability to explain it to other people. You proved it's not true. Thank you for the fantastic Monad explanation!

dedpihter
Автор

Dude, you should really have some commercial videos made! You are the best :)

omkarkulkarni
Автор

Was waiting for such a Video. I loved the explanation at the end for the monadic laws and it did help a lot by giving concrete examples. Something that can be added as an extra to your advanced scala course. Great Video as always !! :)

sherwin
Автор

Excellent video, sad that so few people have seen it.

VRMediaI