Commit graph

103 commits

Author SHA1 Message Date
b2fe2f4557
Clean up (#64)
* [readme] use valid haskell example

* [tree] Immediately return this expression instead of assigning it to the temporary variable "treeList".

* [tree] Use normal defensive copying for array fields
2019-01-06 12:33:19 +00:00
8357d7f5d8
[tree] Add TreeBuilder (#57)
* [tree] TreeBuilder: whenEmptyBuilderBuildThenTreeIsAnEmptyLeaf()

* [tree] Provide default implementation of count()

* [tree] Extract TreeMapper

* [tree] MutableTree added

* [tree] TreeBuilder: whenAddLeafThenTreeHasLeaf()

* [tree] TreeBuilder: whenAddSubTreeThenTreeHasSubTree()

* [maybe] Add Maybe.findFirst(Stream) and matchValue(Function, Supplier)

* [tree] TreeBuilder: whenAddGrandChildThenTreeHasGrandChild()

* [tree] TreeBuilder: whenAddMultipleChildrenThenTreeHasAllChildren()

* [tree] Tree: avoid leaking MutableTree type as parameters

* [changelog] update

* [changelog][readme] Update to include TreeBuilder
2018-10-14 08:55:09 +01:00
73e59b0050
Bump junit from 4.12 to 5.3.1 (#56)
* Bump junit from 4.12 to 5.3.1

* [changelog] update

* [jenkins] stop publishing to codacy and test build with java 11
2018-10-12 20:42:11 +01:00
00d8808479 [result] orElseThrow() throws error within a CheckedErrorResultException 2018-10-06 19:58:50 +01:00
aed85d5488 [result] toMaybe fix typo 2018-10-04 07:55:34 +01:00
48e19fb653 [result] add orElseThrow(Class) and orElseThrowUnchecked()
Split `MonResultException` into `ErrorResultException` and `UnexpectedErrorResultException`.
2018-10-04 07:24:50 +01:00
c0ee1cdbc7 [result] orElseThrow() wraps the error exception in an unchecked MonResultException 2018-10-03 21:58:33 +01:00
d1adfd46d2 [lazy] add test to verify re-entrant behaviour of value() 2018-10-01 22:09:31 +01:00
9249ba8f59 [lazy] Add a lazy evaluator 2018-09-30 19:37:30 +01:00
f5c10e668d [tree] Add a Generalised Tree 2018-09-30 18:05:41 +01:00
93ad09c2fc [license] Update year to 2018 2018-09-29 19:59:38 +01:00
f26c5f07d5 Bump kemitix-checkstyle-ruleset from 4.1.1 to 5.0.0 2018-09-29 19:44:30 +01:00
Paul Campbell
11912a070e Fix typo in javadoc 2018-09-01 06:34:00 +01:00
Paul Campbell
1ca686a3f6 Add Maybe.or(Supplier<Maybe>)
Like a flatMap for the negative case.
2018-08-31 22:53:06 +01:00
4542d82c1a Rename Result.invert as swap 2018-07-21 22:42:16 +01:00
b80650b6ae Add Result.reduce(Result,BinaryOperator) 2018-07-20 18:40:33 +01:00
a1a7ad65c2 Left/Right: don't use @Getter for final fields
QA tools want these fields to be static, for which lombok creates static getter
methods, which then don't match the specification from the `Either` interface.
2018-07-16 22:39:28 +01:00
e8989718f3 README.org: expand TypeAlias documentation and add TypeAlias.flatMap() 2018-07-16 20:56:56 +01:00
e5958ba432 Add Either (experimental) 2018-07-16 18:49:44 +01:00
9a6c58c835 Rewrite README and convert to org-mode
* MaybeTest use static import Maybe.*
* Maybe.orElseThrow() now returns value when is a Just
2018-07-15 20:59:49 +01:00
51f86884fb Add Maybe.isJust() and Maybe.isNothing() 2018-07-12 20:28:34 +01:00
d66c4c8502 Add Maybe.match(Consumer,Runnable) 2018-07-12 18:45:02 +01:00
c64284872c Rename Result.maybeThen() as Result.flatMapMaybe() 2018-07-10 22:46:22 +01:00
3c60da2735 * Add Result.maybeThen(Result<Maybe<T>>, Function) 2018-07-10 17:37:54 +01:00
9138cbba46 ResultTest: tidy up test names 2018-07-09 15:47:27 +01:00
a9beeacf0b Update ResultTest sample businessOperation 2018-07-09 15:24:28 +01:00
f6eb27450f Add thenWith(Function) 2018-07-09 08:00:53 +01:00
fb6b65e6de Add andThen(Function) 2018-07-08 19:46:45 +01:00
28564a2129 Add Result.recover(Function) and Result.onError(Consumer) 2018-07-07 23:02:02 +01:00
c5247d7c14 Add Maybe.ifNothing(Runnable) 2018-07-07 18:21:35 +01:00
7648967f8a TypeAlias: access own member fields directly 2018-07-05 07:27:17 +01:00
9923bbc880 Add Result.peek(Consumer) 2018-06-30 18:13:29 +01:00
248bda0b4f Add Result.of(Callable) to reduce boiler plate when calling 2018-06-30 16:24:06 +01:00
1e85a14165 Result.Err.equals(): test when error is different 2018-06-26 22:18:32 +01:00
3e80dded1d Move BeanBuilder to experimental package and allow multiple with() calls 2018-06-26 07:31:03 +01:00
2f5b01f460 Remove Identity 2018-06-26 07:22:32 +01:00
18aa6406ef Result extends Functor 2018-06-26 07:19:39 +01:00
1f986139bc Tidy up checkstyle violations 2018-06-26 07:13:48 +01:00
684cdc06ae New and updated hashcode tests 2018-06-26 07:10:07 +01:00
24a233db5c Implement Result.equals() and hashcode() 2018-06-25 22:51:18 +01:00
7e92129dfc Merge branch 'enhance-result'
* enhance-result:
  Result satisfies the three Monad Laws
  Maybe satisfies the three Monad Laws
  Collapse Maybe{Optional,Stream} into Maybe
  Remove Maybe.fromOptional(Optional)
  Add Result.toString() implementations
  Add Result.toMaybe() and Result.invert()
  Suppress warning for unchecked cast
  Add Result.orElseThrow()
  Add Result.fromMaybe(Maybe, Supplier<Exception>)
  Added Result.maybe()
  Add Result.map()
2018-06-25 22:46:26 +01:00
093e35b4c1 Result satisfies the three Monad Laws 2018-06-25 22:39:25 +01:00
5d39be36ff Maybe satisfies the three Monad Laws 2018-06-25 22:36:18 +01:00
2211182c7d Collapse Maybe{Optional,Stream} into Maybe 2018-06-25 22:06:05 +01:00
7a150066a9 Remove Maybe.fromOptional(Optional) 2018-06-25 21:59:24 +01:00
3496fa0972 Add Result.toString() implementations 2018-06-25 21:54:55 +01:00
a62b2c8920 Remove Maybe.fromOptional(Optional) 2018-06-25 07:16:12 +01:00
f0be463028 Add Result.toMaybe() and Result.invert() 2018-06-24 22:36:02 +01:00
8ec3069d1d Suppress warning for unchecked cast 2018-06-24 08:16:54 +01:00
e9184f88bf Add Result.orElseThrow() 2018-06-24 08:16:24 +01:00