diff --git a/monad/etc/monad.png b/monad/etc/monad.png
new file mode 100644
index 000000000..f82e7a3e4
Binary files /dev/null and b/monad/etc/monad.png differ
diff --git a/monad/etc/monad.ucls b/monad/etc/monad.ucls
new file mode 100644
index 000000000..9c98df7c6
--- /dev/null
+++ b/monad/etc/monad.ucls
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/monad/index.md b/monad/index.md
index a11360a2e..031b899cc 100644
--- a/monad/index.md
+++ b/monad/index.md
@@ -3,17 +3,21 @@ layout: pattern
title: Monad
folder: monad
permalink: /patterns/monad/
-categories: Presentation Tier
+categories: Other
tags:
- Java
- Difficulty-Advanced
+ - Functional
---
## 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.
+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 takse plain type object and returns this object wrapped in a monadic value.

@@ -25,5 +29,7 @@ Use the Monad in any of the following situations
* when you want to apply each function regardless of the result of any of them
## Credits
+
* [Design Pattern Reloaded by Remi Forax](https://youtu.be/-k2X7guaArU)
* [Brian Beckman: Don't fear the Monad](https://channel9.msdn.com/Shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads)
+* [Monad (functional programming) on Wikipedia] (https://en.wikipedia.org/wiki/Monad_(functional_programming)
\ No newline at end of file
diff --git a/monad/src/main/java/com/iluwatar/monad/User.java b/monad/src/main/java/com/iluwatar/monad/User.java
index de1be5a45..edd299643 100644
--- a/monad/src/main/java/com/iluwatar/monad/User.java
+++ b/monad/src/main/java/com/iluwatar/monad/User.java
@@ -8,11 +8,10 @@ public class User {
private String email;
/**
- *
- * @param name - name
- * @param age - age
- * @param sex - sex
- * @param email - email
+ * @param name - name
+ * @param age - age
+ * @param sex - sex
+ * @param email - email address
*/
public User(String name, int age, Sex sex, String email) {
this.name = name;
diff --git a/monad/src/main/java/com/iluwatar/monad/Validator.java b/monad/src/main/java/com/iluwatar/monad/Validator.java
index 7cc84298d..2298a4d8e 100644
--- a/monad/src/main/java/com/iluwatar/monad/Validator.java
+++ b/monad/src/main/java/com/iluwatar/monad/Validator.java
@@ -11,13 +11,22 @@ import java.util.function.Predicate;
* given object together step by step. In Validator each step results in either success or
* failure indicator, giving a way of receiving each of them easily and finally getting
* validated object or list of exceptions.
+ *
* @param Placeholder for an object.
*/
public class Validator {
+ /**
+ * Object that is validated
+ */
private final T t;
+
+ /**
+ * List of exception thrown during validation.
+ */
private final List exceptions = new ArrayList<>();
/**
+ * Creates a monadic value of given object.
* @param t object to be validated
*/
private Validator(T t) {
@@ -52,6 +61,7 @@ public class Validator {
/**
* Extension for the {@link Validator#validate(Function, Predicate, String)} method,
* dedicated for objects, that need to be projected before requested validation.
+ *
* @param projection function that gets an objects, and returns projection representing
* element to be validated.
* @param validation see {@link Validator#validate(Function, Predicate, String)}
@@ -65,7 +75,7 @@ public class Validator {
}
/**
- * To receive validated object.
+ * Receives validated object or throws exception when invalid.
*
* @return object that was validated
* @throws IllegalStateException when any validation step results with failure