using Microsoft.FSharp.Core; namespace CommonCore.Base.Structures; public static class MaybeExtensions { public static Maybe FirstOrEmpty(this IEnumerable col) => col.FirstOrDefault() ?? Maybe.Empty(); public static T? ToNullable(this Maybe item) where T : struct => item.HasValue ? item.Value : null; public static FSharpOption ToFSharpOption(this Maybe cb) => cb.HasValue ? FSharpOption.Some(cb.Value) : FSharpOption.None; }