Skip to content
0:00 / 0:00

#monads#dependencyinjection#asyncawait

Get value out of your monad - Mark Seemann

NDC Conferences

230K subscribers • 110 videos on Hallway • Conference channel

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • A classic. People kept recommending it from 2021 to 2024.
  • Presented by Mark Seemann, software architect

Intermediate. Assumes working knowledge.

26K views8 years ago2 recommendations

Software designProgramming languagesC# and .NETFunctional programmingDesign patterns

Mark Seemann explains how to use monads in C# to solve common architectural challenges like combining dependency injection with async/await.

This talk attempts to answer a pair of frequently asked questions, the first one of which is: how do I get the value out of my monad? It turns out that the answer to that question ultimately addresses another frequently asked question: how do I combine dependency injection with async and await in C# without leaky abstractions? During the talk, you’ll also get a quick and easy-to-understand explanation of monads. There will also be containers. All code examples will be in C#. NDC Conferences ndcsydney.com ndcconferences.com

Why it's here

2 people recommend this

What people say. Recommended for its clear explanation of monads and how they apply to real-world C# architecture and async patterns.

u/venomizin r/dotnet • Recommends

On “The Awaitable Pattern plays a vital role in the whole async/await workflow behind the scenes. The best way to understand how it works is to build your own awaitable type. Let’s see how!”

This post reminded me of this talk.

u/ACR-FornaXin r/dotnet • Recommends

On “Check out my result type implementation.”

I come late to the party, but I want to give you my 2 cents, since I usually roll my own implementation and have some experience with it. If you want this to use it for yourself and yourself only, yeah, this could work and is totally fine. But if you want to implement this in a team, this kind of pattern that I've seen a lot (*IsSuccess, Data, Error*) will end up biting you in the ass. You see, the good thing about results is not only that you don't throw exceptions, is that you encapsulate behaviour into a class **safely**. What happens if someone forgets to check *IsSuccess*? What happens if someone just accesses *Data*, without even checking anything? What's the difference between doin…

u/Tubthumper8in r/typescript • Mentions

On “How to know if a function throws in Typescript?”

It's still different than Go, because your technique returns the data OR an error, and you have to check. Go returns the data AND an error, and _hopes_ that you check. I do like the idea behind fp-ts but you have to go all in on it, which might be feasible on solo projects but usually not on a team that is used to imperative programming. If you're constantly wrapping and unwrapping `Either`, you're gonna have a bad time. It's hard to get the mindshift to You Don't Unwrap Monads, instead, you chain them to the next expression.