Skip to content

Extension operators supported for more types

Pre-release
Pre-release

Choose a tag to compare

@louthy louthy released this 14 Nov 18:19
· 111 commits to main since this release

Following on from the extension-operators and .NET 10 release yesterday, I have now implemented operators for even more of the core types in language-ext.

The full set so far:

  • ChronicleT<Ch, M, A>
  • Eff<A>
  • Eff<RT, A>
  • Either<L, R>
  • EitherT<L, M, R>
  • Fin<A>
  • FinT<M, A>
  • IO<A>
  • Option<A>
  • OptionT<M, A>
  • These<A, B>
  • Try<A>
  • TryT<M, A>
  • Validation<F, A>
  • ValidationT<F, M, A>

There is no need to do any of these to make the extension operators work for the types, but the generic extensions will all return an abstract K<F, A> type. So, I am in the process of making these bespoke versions return a concrete type. This is purely for usability's sake.

And because each core type can support many different traits, the number of operators they support can be quite large too (see the Try operators for a good example!). So, for each core type I've decided on a new folder structure:

TYPE folder
  | ----- TYPE definition.cs
  | ----- TYPE module.cs
  | ----- TYPE case [1 .. n].cs  (Left, Right, Some, None, etc.)
  | ----- Extensions
  | ----- Operators
  | ----- Prelude

This will keep the many method extensions and operator extensions away from the core functionality for any one type: which hopefully will make the API docs easier to read and the source-code easier to navigate.

Let me know if you see any quirkiness with the new operators. This is a lot of typing, so it would be good to catch issues early!