From 976bf55fcdc776a5fc6a40fd563a6a7514913f20 Mon Sep 17 00:00:00 2001 From: Ruben Schmidmeister Date: Tue, 14 Jul 2020 16:21:19 +0200 Subject: [PATCH 1/5] Update changelog --- changelog.md | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 42e1ff54..e54fcf6c 100644 --- a/changelog.md +++ b/changelog.md @@ -41,19 +41,46 @@ * Fix incorrect implementation on `Result.SelectMany` which called the `selectedResultSelector` even when the result was an error. As a result (pun intended) of the fix, `ResultCombinationException` is no longer needed and also removed. -## Unreleased -* Add extension method for `HttpHeaders.TryGetValues`, which returns an `Option`. +## 2.0.0 + +### Breaking Changes +* Remove `Reader` monad based on `await`. +* Remove `IToString`. * Remove overload for `Option.From` that flattens passed `Option`s. -* Add extension methods for getting `Stream` properties that are not always available, as `Option`: - `GetLengthOrNone`, `GetPositionOrNone`, `GetReadTimeoutOrNone`, `GetWriteTimeoutOrNone`. * Move `ToEnumerable` extension method to its own class. This is only a breaking change if you've used the extension method as normal method. In that case you need to change `EnumerableExtensions.ToEnumerable` to `ObjectExtensions.ToEnumerable`. -* Implement `IEquatable` on `Option`, `Result` and `Either`. +* Rename `Option.From` -> `Option.FromNullable` and remove overload that takes non-nullable value types. +* Unify `Option.ToEnumerable` and `Yield` to `ToEnumerable` +* Rename `OrElse` overloads that return the item to `GetOrElse` which improves overload resolution. +* The `Each` extension method on `IEnumerable` has been renamed to `ForEach`. +* Move the `Ok` constructor of `Result` to a non-generic class. This allows for the compiler to infer the generic type. + Old: `Result.Ok(10)`. New: `Result.Ok(10)`. +* Use `Func` instead of `Predicate` in predicate composition functions (`Functional.All`, `Functional.Any`, `Functional.Not`), + because most APIs in `System` use `Func`. +* `Functional.Any` now returns `false` when the given list of predicates is empty. + +### Fixes * Fix incorrect `Equals` implementation on `Option`. `Equals` previously returned `true` when comparing a `None` value with a `Some` value containing the default value of the type. +* `Exception` created by `Result` monad contains valid stack trace +* Fix incorrect implementation on `Result.SelectMany` which called the `selectedResultSelector` even when the + result was an error. As a result (pun intended) of the fix, `ResultCombinationException` is no longer needed and also removed. + +### Additions +* Add `IndexOfOrNone`, `LastIndexOfOrNone`, `IndexOfAnyOrNone` and `LastIndexOfAnyOrNone` extension methods to `string`. +* Added `Curry`, `Uncurry` and `Flip` to the `Functional` Class +* Add extension method for `HttpHeaders.TryGetValues`, which returns an `Option`. +* Add extension methods for getting `Stream` properties that are not always available, as `Option`: + `GetLengthOrNone`, `GetPositionOrNone`, `GetReadTimeoutOrNone`, `GetWriteTimeoutOrNone`. * Add `None` extension method to `IEnumerable`. * `Option>`, `Option` and their `ValueTask` equivalents are now awaitable: ```csharp var answer = await Option.Some(Task.FromResult(42)); ``` + +### Improvements +* Full nullable support introduced with C# 8. +* Mark our functions as `[Pure]`. +* Implement `IEquatable` on `Option`, `Result` and `Either`. + From 719faf8704ef1ec736f9cb38ed9f7bc6b6f24b19 Mon Sep 17 00:00:00 2001 From: Ruben Schmidmeister Date: Tue, 14 Jul 2020 16:21:39 +0200 Subject: [PATCH 2/5] Use preposition instead of arrow --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index e54fcf6c..381698c4 100644 --- a/changelog.md +++ b/changelog.md @@ -50,7 +50,7 @@ * Move `ToEnumerable` extension method to its own class. This is only a breaking change if you've used the extension method as normal method. In that case you need to change `EnumerableExtensions.ToEnumerable` to `ObjectExtensions.ToEnumerable`. -* Rename `Option.From` -> `Option.FromNullable` and remove overload that takes non-nullable value types. +* Rename `Option.From` to `Option.FromNullable` and remove overload that takes non-nullable value types. * Unify `Option.ToEnumerable` and `Yield` to `ToEnumerable` * Rename `OrElse` overloads that return the item to `GetOrElse` which improves overload resolution. * The `Each` extension method on `IEnumerable` has been renamed to `ForEach`. From 379e91470e8facdf31595a37c34c4d08b0ca5d3e Mon Sep 17 00:00:00 2001 From: Ruben Schmidmeister Date: Tue, 14 Jul 2020 16:22:26 +0200 Subject: [PATCH 3/5] Bump version --- Funcky/Funcky.csproj | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Funcky/Funcky.csproj b/Funcky/Funcky.csproj index a801ada1..fa17dc75 100644 --- a/Funcky/Funcky.csproj +++ b/Funcky/Funcky.csproj @@ -16,9 +16,7 @@ https://github.com/messerli-informatik-ag/funcky https://github.com/messerli-informatik-ag/funcky Functional Monad - 2.0.0-rc.2 - 2.0.0.0 - 2.0.0.0 + 2.0.0 true snupkg From 08a724855ba53cfe0ceef0553bdaedb9565072b1 Mon Sep 17 00:00:00 2001 From: Ruben Schmidmeister Date: Tue, 14 Jul 2020 16:26:01 +0200 Subject: [PATCH 4/5] Remove unused warning suppressions --- Funcky/Funcky.csproj | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Funcky/Funcky.csproj b/Funcky/Funcky.csproj index fa17dc75..cbcacd20 100644 --- a/Funcky/Funcky.csproj +++ b/Funcky/Funcky.csproj @@ -1,5 +1,4 @@ - netstandard2.0;netstandard2.1 8.0 @@ -20,12 +19,4 @@ true snupkg - - - $(NoWarn);1591 - - - - $(NoWarn);1701;1702 - From efc9a628d42fe2f75ac67d7375094756230c8cc8 Mon Sep 17 00:00:00 2001 From: Ruben Schmidmeister Date: Tue, 14 Jul 2020 16:34:48 +0200 Subject: [PATCH 5/5] Update changelog.md --- changelog.md | 1 - 1 file changed, 1 deletion(-) diff --git a/changelog.md b/changelog.md index 381698c4..425c7a19 100644 --- a/changelog.md +++ b/changelog.md @@ -83,4 +83,3 @@ * Full nullable support introduced with C# 8. * Mark our functions as `[Pure]`. * Implement `IEquatable` on `Option`, `Result` and `Either`. -