-
Notifications
You must be signed in to change notification settings - Fork 15
V4BreakingChanges
V4 of Succinc<T> has been nearly two years in the making. It's started, stopped, scrapped, restarted, and restarted all over again as details of C# 8 were revealed and eventually released. Along the way, I've experimented with Nullable Reference Types, the new pattern matching features and read-only structs and made changes to make best use of these features. Many of these changes radically change things and so constitute breaking changes.
The struct, Maybe<T>
is no more. It's an ex-type. Previously, Option<T>
was a class and Maybe<T>
, a struct. But Option<T>
is now a read-only struct, so Maybe<T>
no longer has a purpose and has been removed.
The Option<T>
type has been changed from a class to a read-only struct. This prevents problems with null
and - by using in
parameters, allows it to be passed around by reference so avoids performance issues of struct copying.
The relationship between Option<T>
and null
has been tightened up. A null
value always equates to none
. Attempting to create a value via eg Option<string>.Some(null)
now results in an ArgumentNullException
being thrown.
In order to support C# 8's enhanced pattern matching, the supplied Deconstruct
method has changed.
This type has also changed to be a read-only struct.
Because TryLeft
and TryRight
return Option<TLeft>
and Option<TRight>
, respectively, if the value in the either is null
, the try methods will now return none
.
All of these types have also changed to be read-only structs.
This method is no longer required as C# 7's discards offer the same thing without needing a delegate. So this method has been removed.
Both of these methods now use the struct, Enum
constraint. Previously, it was just constrained to struct
. This really shouldn't affect anyone as calling these with anything other than an enum type resulted in an exception being thrown.
Action
/Func
conversionsCycle
methods- Converting between
Action
andFunc
- Extension methods for existing types that use
Option<T>
- Indexed enumerations
IEnumerable<T>
cons- Option-based parsers
- Partial function applications
- Pattern matching
- Pipe Operators
- Typed lambdas
Any
Either<TLeft,TRight>
None
Option<T>
Success<T>
Union<T1,T2>
Union<T1,T2,T3>
Union<T1,T2,T3,T4>
Unit
ValueOrError