Releases: DigitecGalaxus/Galaxus.Functional
4.2.1
4.2.0
4.1.0
4.0.0
New features
- New package
Galaxus.Functional.NUnit
to make writing assertions onOption
s andResult
s easier- Example:
Assert.That(myOption, Is.Some.WithValue.EqualTo(1))
orAssert.That(myResult, Is.Err)
- Example:
Breaking changes
- Renamed
AttemptToUnwrapNoneWhenOptionContainedSomeException
toTriedToUnwrapNoneException
- Renamed
AttemptToUnwrapErrWhenResultWasOkException
toTriedToUnwrapErrException
- Removed
Option.UnwrapOrDefault
andResult.UnwrapOrDefault
(plus their async variants)- For
Option
, you can useToNullable
instead!
- For
- All the
SomethingAsync
-methods (like e.g.MatchAsync
) are now consistently implemented as extension methods- If you're relying on automatic type conversion, you probably have to specify the type parameters explicitly for these cases now
3.5.0
This release brings two new methods; one for convertign Option
s to Either
s and another to bring the FirstOrNone
-style operations to Dictionary
.
Using someOption.ToEither(fallback)
, you can turn an Option<TSome>
into an Either<TSome, TFallback>
. As expected, Some
will be the A
while the provided fallback will be used as B
if the option is None
.
Using dictionary.GetValueOrNone(key)
, you can extract a value from a dictionary - or not, if the key is not present - similar to how FirstOrNone
and others work.
3.4.0
3.3.0
Both Either<A, B>
and Either<A, B, C>
just got a lot better! Instead of manually checking which discriminant the either is, you can check directly using IsA
, IsB
and IsC
which does what you'd expect. In addition to that, there's also SelectA
, SelectB
and SelectC
for an enumerable of eithers. Similar to SelectSome
, they allow you to iterate over all Either
s that are A
.. or B
or C
.