Michael Bull
|
4b745d8717
|
Merge {AndThen,Binding}Benchmarks
jmh-visualiser displays them comparatively when they are in the same class.
|
2020-05-11 11:54:50 +01:00 |
|
Tristan Hamilton
|
0910e9ffe4
|
Add benchmarking framework
|
2020-05-11 11:28:51 +01:00 |
|
Tristan Hamilton
|
9bcaa974ca
|
Add monad comprehensions via binding block
|
2020-05-11 10:34:55 +01:00 |
|
Michael Bull
|
1000c588c0
|
Add Result#toErrorUnless
Gives us symmetry with the kotlin stdlib:
- https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/take-if.html
- https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/take-unless.html
|
2020-04-18 11:48:45 +01:00 |
|
Michael Bull
|
22898fff4f
|
Add compiler contract to Result#toErrorIf
|
2020-04-18 11:43:31 +01:00 |
|
Markus Padourek
|
cf9582075d
|
Add Result#toError
Facilitates transforming an Ok to an Err if the value satisfies a given
prdicate.
|
2020-04-18 11:39:36 +01:00 |
|
Michael Bull
|
4ed42cc407
|
Replace code blocks in comments with variable references
|
2020-01-31 09:21:41 +00:00 |
|
Michael Bull
|
43ebd5753a
|
Add Rust's mapOr & mapOrElse
See: https://blog.rust-lang.org/2020/01/30/Rust-1.41.0.html#library-changes
|
2020-01-31 09:17:49 +00:00 |
|
Michael Bull
|
434b8aa7fb
|
Fix typo in Result#unwrap exception message
Fixes #8
|
2020-01-11 10:14:59 +00:00 |
|
Michael Bull
|
1bf2125327
|
Support destructuring declarations
val (value: String?, error: Throwable?) = runCatching(yourFunction)
|
2019-09-27 09:29:50 +01:00 |
|
Michael Bull
|
586b260683
|
Deprecate Result.of in favour of runCatching factory function
Matches Kotlin's stdlib and becomes top-level
|
2019-08-24 00:20:46 +01:00 |
|
Michael Bull
|
66f1122efb
|
Add compiler contracts
See: https://kotlinlang.org/docs/reference/whatsnew13.html#contracts
|
2019-08-09 21:53:52 +01:00 |
|
Michael Bull
|
7e6f4d1104
|
Use generic identifiers from kotlin stdlib for zip functions
|
2019-05-30 11:55:11 +01:00 |
|
Michael Bull
|
65b9065164
|
Inline "when" variable declarations
|
2019-05-30 11:48:12 +01:00 |
|
Michael Bull
|
63da9642fb
|
Remove internal modifiers from test classes/methods
|
2018-11-01 19:02:57 +00:00 |
|
Michael Bull
|
97d0567489
|
Update example application
|
2018-11-01 12:13:15 +00:00 |
|
Michael Bull
|
b6bb3aafaa
|
Correct test method names in OnTest
|
2018-11-01 11:42:57 +00:00 |
|
Michael Bull
|
b5aab62af4
|
Add Result.recover
Similar to getOrElse but returns an Ok of the transformed error
|
2018-11-01 11:42:09 +00:00 |
|
Michael Bull
|
3a3b5415a7
|
Return the Result in on{Success,Failure}
This facilitates chaining onSuccess/onFailure calls that may perform
arbitrary side-effects, such as logging.
|
2018-11-01 11:25:20 +00:00 |
|
Michael Bull
|
4eb5d80f91
|
Add fold as an alias to mapBoth
|
2018-11-01 11:17:40 +00:00 |
|
Michael Bull
|
21db2e5e4f
|
Mark new mapping functions as inline
|
2018-09-18 20:16:17 +01:00 |
|
Michael Bull
|
1377350895
|
Consistently wrap documentation at 100 characters
|
2018-09-18 20:00:50 +01:00 |
|
Michael Bull
|
29e21e57a0
|
Avoid creating unnecessary Err elements in map functions
|
2018-09-18 19:48:23 +01:00 |
|
Michael Bull
|
e43a7008d8
|
Add more mapping functions for Iterables
- mapAll
- mapResult
- mapResultTo
- mapResultNotNull
- mapResultNotNullTo
- mapResultIndexed
- mapResultIndexedTo
- mapResultIndexedNotNull
- mapResultIndexedNotNullTo
|
2018-09-18 19:40:07 +01:00 |
|
Michael Bull
|
d7f09ec6d7
|
Update links to elm-result-extra
|
2018-08-09 15:09:15 +01:00 |
|
Michael Bull
|
410563b621
|
Add toResultOr
Acts as a factory function to convert nullable types to Result types
|
2018-01-24 18:20:39 +00:00 |
|
Michael Bull
|
631f81d8ae
|
Fix mis-ordered modifier keywords
https://kotlinlang.org/docs/reference/coding-conventions.html#modifiers
|
2018-01-19 14:21:32 +00:00 |
|
Michael Bull
|
76870ef78a
|
Catch Exception instead of Throwable in Result.of
|
2018-01-11 18:31:10 +00:00 |
|
Michael Bull
|
c2fc72d0cb
|
Add zip functions
|
2018-01-11 18:28:31 +00:00 |
|
Michael Bull
|
c5a11a914e
|
Simplify doc comments according to Kotlin Coding Conventions
https://kotlinlang.org/docs/reference/coding-conventions.html#documentation-comments
|
2018-01-10 16:04:40 +00:00 |
|
Michael Bull
|
c6be93142d
|
Add lazy variants for {and,or,getOr,getErrorOr}
|
2018-01-10 13:27:02 +00:00 |
|
Michael Bull
|
44a4467595
|
Alias flatMap function to andThen
|
2017-12-17 00:16:03 +00:00 |
|
Michael Bull
|
b2d29d62b7
|
Improve javadoc
|
2017-12-17 00:14:27 +00:00 |
|
Michael Bull
|
3e3b649193
|
Mark on{Success,Failure} as infix
|
2017-12-16 22:30:04 +00:00 |
|
Kevin Herron
|
47fa20ca34
|
Inline the onSuccess() and onFailure() functions
|
2017-12-16 14:12:07 -08:00 |
|
Michael Bull
|
9ddac98e0c
|
Add multi-platform support
Converts the unit tests to use kotlin-test, allowing them to target both
the jvm and js platforms.
|
2017-12-16 19:30:54 +00:00 |
|
Michael Bull
|
e455be2cc8
|
Make lambda return type of expect{Err} return Any
When constructing the exception message the toString method will be
implicitly called on the result of the lambda.
Takes inspiration from Kotlin's require function [1].
[1]: https://github.com/JetBrains/kotlin/blob/v1.2.0/libraries/stdlib/src/kotlin/util/Preconditions.kt#L26
|
2017-11-28 18:23:36 +00:00 |
|
Michael Bull
|
b513c09470
|
Suppress unreachable code warnings in MapTest
These are intentional and are necessary to identify broken behaviour in
future, therefore the warnings are redundant.
|
2017-11-22 23:41:32 +00:00 |
|
Michael Bull
|
5d5195af9d
|
Add getErrorOrElse
Matches getOrElse signature with respect to the error.
|
2017-11-22 23:25:28 +00:00 |
|
Michael Bull
|
ad7adacf39
|
Lazily evaluate message argument in expect/expectError
|
2017-11-22 23:25:28 +00:00 |
|
Michael Bull
|
af13c9ee7c
|
Rename Error class to Err
Avoids naming conflict with the stdlib's Error class, also now matches
Rust's naming.
|
2017-10-22 16:08:26 +01:00 |
|
Michael Bull
|
1933c9f845
|
Use filterIsInstance in getAll methods
|
2017-10-22 16:07:24 +01:00 |
|
Michael Bull
|
7be628e79e
|
Add unit tests for Result.of
|
2017-10-22 16:07:24 +01:00 |
|
Michael Bull
|
f0fb536516
|
Add Result.of factory method
Inspired by result4k, invokes a callback within a try/catch block,
returning an Error if an exception was thrown and Ok otherwise.
|
2017-10-22 16:07:24 +01:00 |
|
Michael Bull
|
dc4101b8ef
|
Remove factory methods and expose Ok/Error constructors
Also converts them to data classes.
|
2017-10-22 16:07:24 +01:00 |
|
Michael Bull
|
bf3aaee77b
|
Move to new package name
|
2017-10-22 00:59:16 +01:00 |
|
Michael Bull
|
ff40e12e6f
|
Add inline documentation to library methods
|
2017-10-21 21:19:21 +01:00 |
|
Michael Bull
|
9acd99dffd
|
Pass error/value to UnwrapException message
|
2017-10-21 19:17:01 +01:00 |
|
Michael Bull
|
6f21fd634b
|
Correct variable naming in OrTest
|
2017-10-21 19:04:23 +01:00 |
|
Michael Bull
|
eb4aecaab8
|
Correct generic type identifier on mapError
|
2017-10-21 18:52:14 +01:00 |
|