Skip to content

Commit 24289b5

Browse files
authored
Merge pull request #808 from polyadic/release-3.5.0
Prepare 3.5.0 Release
2 parents fe5eb5c + 73fca1c commit 24289b5

File tree

10 files changed

+80
-15
lines changed

10 files changed

+80
-15
lines changed

Funcky.Analyzers/Funcky.Analyzers.Package/Funcky.Analyzers.Package.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313
<PropertyGroup Label="NuGet Metadata">
1414
<PackageId>Funcky.Analyzers</PackageId>
15-
<PackageVersion>1.3.0</PackageVersion>
15+
<PackageVersion>1.4.0</PackageVersion>
1616
<Description>Analyzers to guide to the correct usage of Funcky.</Description>
1717
<PackageTags>funcky, analyzers, roslyn</PackageTags>
1818
<DevelopmentDependency>true</DevelopmentDependency>

Funcky.Analyzers/Funcky.Analyzers/AnalyzerReleases.Shipped.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ Rule ID | Category | Severity | Notes
2424
λ1007 | Funcky | Warning | OptionMatchAnalyzer
2525
λ1008 | Funcky | Warning | OptionMatchAnalyzer
2626

27-
## Release 1.3
27+
## Release 1.4
28+
### New Rules
29+
Rule ID | Category | Severity | Notes
30+
--------|----------|----------|-------
31+
λ1009 | Funcky | Error | NonDefaultableAnalyzer

Funcky.Analyzers/Funcky.Analyzers/AnalyzerReleases.Unshipped.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@
44
### New Rules
55
Rule ID | Category | Severity | Notes
66
--------|----------|----------|-------
7-
λ1009 | Funcky | Error | NonDefaultableAnalyzer

Funcky.Async/Funcky.Async.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Nullable>enable</Nullable>
66
<Description>Extends Funcky with support for IAsyncEnumerable and Tasks.</Description>
77
<PackageTags>Functional Async Monad Linq</PackageTags>
8-
<Version>1.3.0</Version>
8+
<Version>1.4.0</Version>
99
<IncludeSymbols>true</IncludeSymbols>
1010
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1111
</PropertyGroup>

Funcky.Xunit/Funcky.Xunit.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Nullable>enable</Nullable>
66
<Description>Package to use Funcky with xUnit</Description>
77
<PackageTags>Functional Monad xUnit</PackageTags>
8-
<Version>2.0.2</Version>
8+
<Version>2.1.0</Version>
99
<IncludeSymbols>true</IncludeSymbols>
1010
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1111
<RootNamespace>Funcky</RootNamespace>

Funcky/DownCast.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@ namespace Funcky;
33
public static class DownCast<TResult>
44
where TResult : class
55
{
6+
/// <summary>Downcasts the <c>Some</c> value inside the <c>Option</c> to <typeparamref name="TResult"/>.
7+
/// If the cast fails, <c>None</c> is returned.</summary>
68
public static Option<TResult> From<TItem>(Option<TItem> option)
79
where TItem : class
810
=> option.SelectMany(OptionDownCast);
911

12+
/// <summary>Downcasts the <c>Ok</c> value inside the <c>Result</c> to <typeparamref name="TResult"/>.
13+
/// If the cast fails, an <c>Error</c> value containing a <see cref="InvalidCastException"/> is returned.</summary>
1014
public static Result<TResult> From<TItem>(Result<TItem> result)
1115
where TItem : class
1216
=> result.SelectMany(ResultDownCast);
1317

18+
/// <summary>Downcasts the <c>Left</c> value inside the <c>Either</c> to <typeparamref name="TResult"/>.
19+
/// If the cast fails, the result from calling <paramref name="failedCast"/> is returned.</summary>
1420
public static Either<TLeft, TResult> From<TLeft, TRight>(Either<TLeft, TRight> either, Func<TLeft> failedCast)
1521
where TRight : class
1622
where TLeft : notnull

Funcky/Funcky.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Product>Funcky</Product>
77
<Description>Funcky is a functional C# library</Description>
88
<PackageTags>Functional Monad Linq</PackageTags>
9-
<VersionPrefix>3.4.0</VersionPrefix>
9+
<VersionPrefix>3.5.0</VersionPrefix>
1010
<IncludeSymbols>true</IncludeSymbols>
1111
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1212
<PackageReadmeFile>README.md</PackageReadmeFile>

Funcky/PublicAPI.Shipped.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#nullable enable
22
Funcky.Discard
3+
Funcky.DownCast<TResult>
34
Funcky.EitherOrBoth
45
Funcky.EitherOrBoth<TLeft, TRight>
56
Funcky.EitherOrBoth<TLeft, TRight>.EitherOrBoth() -> void
@@ -188,6 +189,9 @@ override Funcky.Monads.Result<TValidResult>.GetHashCode() -> int
188189
override Funcky.Monads.Result<TValidResult>.ToString() -> string!
189190
override Funcky.Unit.Equals(object? obj) -> bool
190191
override Funcky.Unit.GetHashCode() -> int
192+
static Funcky.DownCast<TResult>.From<TItem>(Funcky.Monads.Option<TItem!> option) -> Funcky.Monads.Option<TResult!>
193+
static Funcky.DownCast<TResult>.From<TItem>(Funcky.Monads.Result<TItem!> result) -> Funcky.Monads.Result<TResult!>
194+
static Funcky.DownCast<TResult>.From<TLeft, TRight>(Funcky.Monads.Either<TLeft, TRight!> either, System.Func<TLeft>! failedCast) -> Funcky.Monads.Either<TLeft, TResult!>
191195
static Funcky.EitherOrBoth.FromOptions<TLeft, TRight>(Funcky.Monads.Option<TLeft> left, Funcky.Monads.Option<TRight> right) -> Funcky.Monads.Option<Funcky.EitherOrBoth<TLeft, TRight>>
192196
static Funcky.EitherOrBoth<TLeft, TRight>.Both(TLeft left, TRight right) -> Funcky.EitherOrBoth<TLeft, TRight>
193197
static Funcky.EitherOrBoth<TLeft, TRight>.Left(TLeft left) -> Funcky.EitherOrBoth<TLeft, TRight>
@@ -377,6 +381,7 @@ static Funcky.Extensions.ListExtensions.FindLastIndexOrNone<TValue>(this System.
377381
static Funcky.Extensions.ListExtensions.FindLastIndexOrNone<TValue>(this System.Collections.Generic.List<TValue>! list, int startIndex, System.Predicate<TValue>! match) -> Funcky.Monads.Option<int>
378382
static Funcky.Extensions.ListExtensions.FindLastIndexOrNone<TValue>(this System.Collections.Generic.List<TValue>! list, System.Predicate<TValue>! match) -> Funcky.Monads.Option<int>
379383
static Funcky.Extensions.ListExtensions.IndexOfOrNone<TValue>(this System.Collections.Generic.IList<TValue>! list, TValue value) -> Funcky.Monads.Option<int>
384+
static Funcky.Extensions.ParseExtensions.ParseAssemblyNameInfoOrNone(this System.ReadOnlySpan<char> candidate) -> Funcky.Monads.Option<System.Reflection.Metadata.AssemblyNameInfo!>
380385
static Funcky.Extensions.ParseExtensions.ParseAuthenticationHeaderValueOrNone(this string? candidate) -> Funcky.Monads.Option<System.Net.Http.Headers.AuthenticationHeaderValue!>
381386
static Funcky.Extensions.ParseExtensions.ParseBigIntegerOrNone(this string? candidate) -> Funcky.Monads.Option<System.Numerics.BigInteger>
382387
static Funcky.Extensions.ParseExtensions.ParseBigIntegerOrNone(this string? candidate, System.Globalization.NumberStyles style, System.IFormatProvider? provider) -> Funcky.Monads.Option<System.Numerics.BigInteger>
@@ -558,6 +563,7 @@ static Funcky.Extensions.ParseExtensions.ParseTimeSpanOrNone(this System.ReadOnl
558563
static Funcky.Extensions.ParseExtensions.ParseTimeSpanOrNone(this System.ReadOnlySpan<char> candidate, System.IFormatProvider? formatProvider) -> Funcky.Monads.Option<System.TimeSpan>
559564
static Funcky.Extensions.ParseExtensions.ParseTransferCodingHeaderValueOrNone(this string? candidate) -> Funcky.Monads.Option<System.Net.Http.Headers.TransferCodingHeaderValue!>
560565
static Funcky.Extensions.ParseExtensions.ParseTransferCodingWithQualityHeaderValueOrNone(this string? candidate) -> Funcky.Monads.Option<System.Net.Http.Headers.TransferCodingWithQualityHeaderValue!>
566+
static Funcky.Extensions.ParseExtensions.ParseTypeNameOrNone(this System.ReadOnlySpan<char> candidate, System.Reflection.Metadata.TypeNameParseOptions? options = null) -> Funcky.Monads.Option<System.Reflection.Metadata.TypeName!>
561567
static Funcky.Extensions.ParseExtensions.ParseUInt16OrNone(this string? candidate) -> Funcky.Monads.Option<ushort>
562568
static Funcky.Extensions.ParseExtensions.ParseUInt16OrNone(this string? candidate, System.Globalization.NumberStyles style, System.IFormatProvider? provider) -> Funcky.Monads.Option<ushort>
563569
static Funcky.Extensions.ParseExtensions.ParseUInt16OrNone(this string? candidate, System.IFormatProvider? provider) -> Funcky.Monads.Option<ushort>
@@ -817,9 +823,11 @@ static Funcky.Monads.ResultExtensions.Traverse<TValidResult, TLeft, TRight>(this
817823
static Funcky.Sequence.Concat<TSource>(params System.Collections.Generic.IEnumerable<TSource>![]! sources) -> System.Collections.Generic.IEnumerable<TSource>!
818824
static Funcky.Sequence.Concat<TSource>(System.Collections.Generic.IEnumerable<System.Collections.Generic.IEnumerable<TSource>!>! sources) -> System.Collections.Generic.IEnumerable<TSource>!
819825
static Funcky.Sequence.Cycle<TResult>(TResult element) -> System.Collections.Generic.IEnumerable<TResult>!
826+
static Funcky.Sequence.CycleMaterialized<TSource>(System.Collections.Generic.IReadOnlyCollection<TSource>! source) -> System.Collections.Generic.IEnumerable<TSource>!
820827
static Funcky.Sequence.CycleRange<TSource>(System.Collections.Generic.IEnumerable<TSource>! source) -> Funcky.IBuffer<TSource>!
821828
static Funcky.Sequence.FromNullable<TResult>(TResult? element) -> System.Collections.Generic.IEnumerable<TResult!>!
822829
static Funcky.Sequence.FromNullable<TResult>(TResult? element) -> System.Collections.Generic.IEnumerable<TResult>!
830+
static Funcky.Sequence.RepeatMaterialized<TSource>(System.Collections.Generic.IReadOnlyCollection<TSource>! source, int count) -> System.Collections.Generic.IEnumerable<TSource>!
823831
static Funcky.Sequence.RepeatRange<TSource>(System.Collections.Generic.IEnumerable<TSource>! source, int count) -> Funcky.IBuffer<TSource>!
824832
static Funcky.Sequence.Return<TResult>(params TResult[]! elements) -> System.Collections.Generic.IReadOnlyList<TResult>!
825833
static Funcky.Sequence.Return<TResult>(TResult element) -> System.Collections.Generic.IReadOnlyList<TResult>!

Funcky/PublicAPI.Unshipped.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
11
#nullable enable
2-
Funcky.DownCast<TResult>
3-
static Funcky.DownCast<TResult>.From<TItem>(Funcky.Monads.Option<TItem!> option) -> Funcky.Monads.Option<TResult!>
4-
static Funcky.DownCast<TResult>.From<TItem>(Funcky.Monads.Result<TItem!> result) -> Funcky.Monads.Result<TResult!>
5-
static Funcky.DownCast<TResult>.From<TLeft, TRight>(Funcky.Monads.Either<TLeft, TRight!> either, System.Func<TLeft>! failedCast) -> Funcky.Monads.Either<TLeft, TResult!>
6-
static Funcky.Extensions.ParseExtensions.ParseTypeNameOrNone(this System.ReadOnlySpan<char> candidate, System.Reflection.Metadata.TypeNameParseOptions? options = null) -> Funcky.Monads.Option<System.Reflection.Metadata.TypeName!>
7-
static Funcky.Extensions.ParseExtensions.ParseAssemblyNameInfoOrNone(this System.ReadOnlySpan<char> candidate) -> Funcky.Monads.Option<System.Reflection.Metadata.AssemblyNameInfo!>
8-
static Funcky.Sequence.CycleMaterialized<TSource>(System.Collections.Generic.IReadOnlyCollection<TSource>! source) -> System.Collections.Generic.IEnumerable<TSource>!
9-
static Funcky.Sequence.RepeatMaterialized<TSource>(System.Collections.Generic.IReadOnlyCollection<TSource>! source, int count) -> System.Collections.Generic.IEnumerable<TSource>!

changelog.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,62 @@
22
All notable changes to this project will be documented in this file.
33
Funcky adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5+
## Funcky 3.5.0 | Funcky.Async 1.4.0 | Funcky.Xunit 2.1.0 | Funcky.Analyzers 1.4.0
6+
This update is mainly to update to .NET 9 but also has several smaller improvements.
7+
8+
### .NET 9
9+
Thanks to the new `[OverloadResolutionPriority]` attribute, we've been able finally fix
10+
the ambiguous call errors when using `DictionaryExtensions.GetValueOrNone`:
11+
12+
```csharp
13+
Dictionary<string, string> favouriteFoods = new();
14+
Option<int> tausFavouriteFood = favouriteFoods.GetValueOrNone("Tau");
15+
// ^^^^^^^^^^^^^^
16+
// This used to produce a `error CS0121: The call is ambiguous between ...` error
17+
// and now simply works 🎉
18+
```
19+
20+
In good old fashion, we've also added new parse extensions:
21+
* `ParseExtensions.ParseAssemblyNameInfoOrNone`
22+
* `ParseExtensions.ParseTypeNameOrNone`
23+
24+
### Policy for EOL Target Frameworks
25+
We've [explicitly written down](SupportPolicy.md) our policy for how we deal
26+
with older / EOL target frameworks.
27+
28+
In short: EOL target frameworks are supported by Funcky until the next major version.
29+
However, we may no longer test Funcky against those target frameworks, so we
30+
can't guarantee that everything works smoothly.
31+
32+
## New APIs
33+
In Funcky 3.0 we've changed `CycleRange` and `RepeatRange` to return an `IBuffer`
34+
to enable us to memoize the collection, preventing unnecessary enumeration. This however
35+
is unpractical for uses where you want to cycle an already materialized collection.
36+
This release adds two new methods to accommodate that use case:
37+
`CycleMaterialized` and `RepeatMaterialized`.
38+
39+
For convenient downcasting of `Option<T>`, `Result<T>` and `Either<TLeft, T>` values, we've added a new
40+
`DownCast` class:
41+
42+
```csharp
43+
Option<object> option = Option.Some("hello world");
44+
Option<string> downcasted = DownCast<string>.From(option);
45+
```
46+
47+
### Funcky.XUnit
48+
`Funcky.XUnit` has been updated to the latest version (2.9.3) of xUnit.net.
49+
50+
Due to changes in xUnit we've had to change the exception type thrown by our `FunctionalAssert` methods
51+
from `AssertActualExpectedException` to `XunitException`.
52+
53+
### Funcky.Analyzers
54+
The new analyzer rule `λ1009` prevents you from accidentally `default`-instantiating
55+
`Either`, `Result` and `EitherOrBoth`.
56+
57+
### Funcky.Async
58+
The `PowerSet` and `WithPrevious` extensions now correctly pass along the cancellation token.
59+
60+
561
## Funcky 3.4.0 | Funcky.Async 1.3.0 | Funcky.XUnit 2.0.2
662

763
This update is mainly to update to .NET 8 but also has several smaller improvements.
@@ -43,7 +99,7 @@ We implemented a few of the IEnumerable extensions which are very useful on stri
4399
* Implemented `InspectEmpty` on `IEnumerable` and `IAsyncEnumerable`
44100
* Implemented `ToAsyncEnumerable` extension on `Option`
45101

46-
### IEnumerator
102+
### IEnumerator
47103

48104
* `MoveNextOrNone` extension on `IEnumerator<T>`
49105

0 commit comments

Comments
 (0)