Files
java-design-patterns/monad
Mughees Qasim 3ae6b07590 refactoring: Issue #2377: The repository code has been refactored to use the recor… (#2505)
* Issue #2377: The repository code has been refactored to use the record class

* Issue #2377: Refactored according to the rules defined for the repo code

* Issue #2377: Refactored according to the rules defined for the repo code

* Issue #2377: Refactored according to the rules defined for the repo code
2023-05-06 12:08:12 +03:00
..
2019-12-07 18:03:49 +02:00
2022-09-14 23:22:24 +05:30

title, category, language, tag
title category language tag
Monad Functional en
Reactive

Intent

Monad pattern based on monad from linear algebra represents the way of chaining operations together step by step. Binding functions can be described as passing one's output to another's input basing on the 'same type' contract. Formally, monad consists of a type constructor M and two operations: bind - that takes monadic object and a function from plain object to monadic value and returns monadic value return - that takes plain type object and returns this object wrapped in a monadic value.

Class diagram

alt text

Applicability

Use the Monad in any of the following situations

  • When you want to chain operations easily
  • When you want to apply each function regardless of the result of any of them

Credits