Repository navigation
Release v7.35.0
The monads in Cratis.Monads gain Cratis-owned members for reading cases and for infrastructure code that needs to inspect or rebuild a monad. This prepares the move away from OneOf in Fundamentals 8. Existing members are unchanged.
Added
GetResult(),GetError(),GetException()andGetValue()on the monads that have those cases. Each returns the value of its case and throwsInvalidOperationExceptionwhen another case is active (#1293)Option<TValue>.Some(value)to create an option that holds a valueFaulted(Exception)onCatch,Catch<TResult>andCatch<TResult, TError>, plusCatch.Faulted<TResult>(…)andCatch.Faulted<TResult, TError>(…).Faultedalways selects the exception case, including forCatch<TResult, Exception>IMonadValue, implemented explicitly by every monad, exposes the active case index and its value to infrastructure code such as serializersMonadTypes.IsMonad,MonadTypes.GetCaseTypesandMonadTypes.Createrecognise monad types, list their cases in order, and create a monad for a given case and value