Skip to content
0:00 / 0:00

#monads#functionalprogramming#optionmonad

The Absolute Best Intro to Monads For Software Engineers

Studying With Alex

41K subscribers • 2 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.

Beginner. No background in the topic needed.

926K views4 years ago1 recommendation

Programming languagesComputer scienceFunctional programmingDesign patterns

This video explains what monads are as a design pattern and how they can be useful without requiring a mathematical background.

If you had to pick the most inaccessible terms in all of software engineering, monad would be a strong contender for first place, because of its spooky math background that uses terms like endofunctor and monoid. As it turns out, monads are an extremely powerful design pattern that can be used without any math knowledge. In this video, we’ll cover what monads are, how they can be incredibly useful, and examine some common monads. All you need is a little software engineering knowledge. Let's go! Dr. Strange Icon Credit: dribbble.com/dalius-stuoka Intro Basic Code Issue #1 Issue #2 Putting It All Together Properties of Monads The Option Monad Monads Hide Work Behind The Scenes Common Monads The List Monad Recap

Why it's here

1 person recommends this

What people say. Recommended as a clear and accessible introduction to monads for developers new to functional programming.

Moments people linked to

u/totorodenethorin r/functionalprogramming • Recommends

Intro to Monads, for software engineers new to monad-y thinking

u/Tubthumper8in r/functionalprogramming • Mentions

On “is this GPT-4 monad example reliable?”

No, this example is not using a monad. 1. The Python type hint `OptionalT` is not a monad, it's a shorthand for `UnionT, None` 2. Like another comment says, the point isn't to check `if user.email is None` (imperatively "unwrapping" it), the usage would be more like applying another function to it using `map`/`flatMap` and having the monad internally handle the None case.(but that's not possible here either because again, Python Optional isn't a real type, it's just syntax sugar) 3. The falling back to a default value is not related to a monad either, and I'd argue that sending emails to a random address is dangerous So sorry, but GPT-4 is pretty wrong here. I'll recommend [this 15 mi…

u/-asap-j-in r/functionalprogramming • Mentions

On “Yet another attempt at monad explanation”

I found this video to be very digestible: link to this video

u/kitaz0s_in r/haskell • Mentions

On “Exam in 10 days and still dont understand Monads. How do I survive and actually understand them in time?”

If you're coming from the imperative programming world, I think this video does a really good job at explaining how Monads are helpful in practice to wrap your computations in some context: link to this video If you're comfortable reading a longer paper, this paper by Phil Wadler is excellent. Comprehending Monads This is a much more involved read than the first video, but if you get through it you'll have a _really_ solid understanding of Monads

u/greg112358132134in r/functionalprogramming • Mentions

On “How Necessary is Knowing Category Theory?”

Not at all in my opinion. It's actually almost easier to understand these concepts through the lens of programming than it is math. you can actually use haskell to understand category theory better. Here's a video on what a monad is practically for example: [video Compare that to the math video: link to this video

u/aaaaargZombiesin r/functionalprogramming • Mentions

On “What’s your favourite way to explain a monad to a beginner?”

not my aproach but this modestly titled video is pretty good The Absolute Best Intro to Monads For Software Engineers

u/calvo-genericoin r/typescript • Mentions

On “Rust Options in Typescript”

You can totally write perfectly functional code with that style. It works and feels natural for tons of devs. But I'll try to pitch you why I believe that using options leads to cleaner code and less bugs. Optionals are a higher abstraction over _missigness_ than `T | undefined`. The main advantage of that it already has high level operations defined, and those operations already consider all the corner cases. Using nullables (`T | undefined`) you need to do operations and checks each time in a add hock fashion: ```ts function returnDoubleIfPresent(n : number | undefined): number | undefined { return n ? n * 2 : undefined // *1 } ``` With options: ```ts function (n: Option<number>): O…
2View on Reddit