DEV Community

Cover image for Cooking with Monads
Andreas Jim
Andreas Jim

Posted on

2

Cooking with Monads

Liquid syntax error: 'raw' tag was never closed

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (3)

Collapse
 
iquardt profile image
Iven Marquardt • Edited

Teaching monads by example may have its advantages but also entails its very own drawbacks. Monads are so general that every specific example you pick looks kind of arbitrarily, because you could have just as well picked another one from the thousands of possibilities.

Maybe it is a good idea to provide both, an example and an abstract decription: What a monad does on a very fundamental level is to turn an ordinary value into a computation of a specific notion. A mere collection of natural numbers [1,2,3], for instance, is turned into a prioritized choice/non deterministic computation. Actually Funtor does that already. Applicative and monads are just ways to sequence such computations. The former statically and the latter dynamically. Falling back to a fuzzy metaphor one can think of functor/applicative/monads as semantics machines or little embedded DSLs.

Collapse
 
devkat profile image
Andreas Jim

Hi Iven, thanks a lot for your comment. I wrote this article back in 2016, when I was starting to seriously dive into functional programming – it was more of a test for myself, whether I understood the concepts well enough to write about them :) Having an imperative programming background, I struggled with the functional concepts; it took me a while to understand how the State monad works, for instance. It took me several months of hands-on experience to actually feel comfortable with monadic programming. To summarize – I'm not claiming that this article teaches anybody what a monad is, but maybe it can be a little bit helpful.

Collapse
 
miaxz90 profile image
Muaz

The coffee machine is unresponsive magnifica vs magnifica s and not powering up, indicating a possible electrical or internal problem.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more