polyadic / funcky

Funcky is a Functional Library for C#
https://polyadic.github.io/funcky
Apache License 2.0
19 stars 3 forks source link

Should we have an `InspectLeft` and `InspectNone`? #730

Closed bash closed 1 year ago

bash commented 1 year ago

We have a SelectLeft for Either. It might be nice to also have inspect for the error case. Use case: Reading an optional value while logging a warning if it's not present:

ReadConfigurationFile()
  .OrElse(() =>
  {
      logger.Warning("Configuration file is missing"));
      return Option<ServerIniConfiguration>.None;
  });