Skip to content

Commit 12dcadb

Browse files
Merge branch 'master' into docs/#149-juu-2.0.1-schema
2 parents 4d512b8 + 917a974 commit 12dcadb

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

README.md

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ return Optional.ofNullable(getNullableString())
9797
.orElse("Oh my god. It is empty");
9898
```
9999

100-
This library has two monads: [`Try`](#try) and [`Lazy`](#lazy).
100+
This library has one monads: [`Try`](#try).
101101

102102
###### Try
103103

@@ -214,34 +214,6 @@ assert 2 == t.orElseThrow();
214214

215215
All terminal operations are listed in the [javadoc](./src/main/java/com/kirekov/juu/monad/Try.java).
216216

217-
###### Lazy
218-
219-
The name of the monad defines its purpose.
220-
221-
```java
222-
Lazy<String> lazy = Lazy.of(this::executeRpc)
223-
.map(String::valueOf);
224-
.map(this::reverseString);
225-
226-
String result = lazy.calculate();
227-
```
228-
229-
The thing is that all declared steps won't be executed
230-
until `calculate` method call. This behaviour is similar
231-
to laziness of Haskell language. `Lazy` can be used to measure
232-
execution time of different chains.
233-
234-
```java
235-
ImmutableList<Lazy<Integer>> list = getList();
236-
ExecutionResult<Integer> minTimeResult =
237-
list.map(lazy -> Measure.executionTime(lazy::calculate)
238-
.inMillis())
239-
.min(Comparator.comparingLong(ExecutionResult::getTime))
240-
.orElseThrow(IllegalStateException::new);
241-
```
242-
243-
You can also combine `Lazy` and `Try` monads to prevent unexpected errors.
244-
245217
##### Collections
246218

247219
The "Collections" part consists of two subparts:

0 commit comments

Comments
 (0)