Skip to content

Release v7.35.0

Choose a tag to compare

@github-actions github-actions released this 29 Nov 19:46
9ce5642

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() and GetValue() on the monads that have those cases. Each returns the value of its case and throws InvalidOperationException when another case is active (#1293)
  • Option<TValue>.Some(value) to create an option that holds a value
  • Faulted(Exception) on Catch, Catch<TResult> and Catch<TResult, TError>, plus Catch.Faulted<TResult>(…) and Catch.Faulted<TResult, TError>(…). Faulted always selects the exception case, including for Catch<TResult, Exception>
  • IMonadValue, implemented explicitly by every monad, exposes the active case index and its value to infrastructure code such as serializers
  • MonadTypes.IsMonad, MonadTypes.GetCaseTypes and MonadTypes.Create recognise monad types, list their cases in order, and create a monad for a given case and value