🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)
🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)

🔧 Programmierung 🕛 kürzlich 3 Min Lesezeit
0

Where is the Monad

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

Have started to learn Scala and stumbled upon Monad concept or I would call it a blunt misconception as all the articles and answers regarding this concept are incomplete, misleading and taste of "confusion".



I recall a discussion, a couple of years ago, with a colleague who was part of Scala study community in the company we were both working for, and an eager promoter of Scala and alike solutions, who mentioned that Scala is more interesting than Java because it contains Monads. When asked about what is a Monad, there was no clear answer however an example was given - "think about it as an Optional(Java8) or Either(from Vavr)".



I ignored it until recently got an opportunity to become a Scala dev that made me analyze and hopefully understand this concept so that there is no ambiguity if I am ever asked about it.



First thing I found out is that Monad is not a concept defined in Scala and that you have to implement it or benefit from already created ones.



Second thing is that a construction like:



int sum = Stream.of("String 1", "String 2", "String 3", "String 4", "String 5")

.mapToInt(String::length)

.reduce(0, Integer::sum);



is a Monad is Java.






Here is how I came to this conclusion.




  1. Have read the articles about Monad, found out it is a Functor.

  2. A Functor is a mapping between Categories, in simple terms it associates for any element x in Category A an element y in Category B,

  3. A Category is a structure that consists of a set of objects, a set of morphisms and a binary operation defined on compatible pairs of morphisms called composition.

  4. A category that has only one object is a Monoid. And this is the key to reverse engineer the whole concept.






From Monoid to Monad






Monoid definition is simple




  1. Set

  2. Binary operation with a result in the same Set

  3. Identity element






So lets define two monoids



Monoid S




  1. A set of all strings

  2. Concatenation operation that result in a string that is also part of set

  3. Identity element is ""



Monoid I




  1. A set of all integers

  2. (+) operation

  3. Identity element is 0






From Monoid to Category



Monoid is a particular form of Category, thus we have two categories S and I.






From Category to Functor



We define a morphism from Category S to Category I:



(String item) -> item.length






And we have the java Monad



sum = Stream.of("String 1", "String 2", "String 3", "String 4", "String 5")

.mapToInt(String::length)

.reduce(0, Integer::sum);



I am still at the beginning, so leaving this topic opened until a better answer is found. Feel free to let me know your thoughts, don't forget to mention your sources.






Sources



Monad:



Category:



Monoid:

https://en.wikipedia.org/wiki/Monoid#Monoid_homomorphisms

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
3 Quellen
GPT-6 Astra Release Today? OpenAI’s Next Major AI Model Is Almost Here
1 Quelle
Apple accuses OpenAI of destroying evidence as trade-secrets fight intensifies
1 Quelle
Major AI platforms go down in unprecedented simultaneous outage
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Where is the Monad

Thematisch verwandte Begriffe: Where, Monad · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...