<commit_before>﻿namespace FSharp.Core.CS

open System
open System.Runtime.CompilerServices

[<Extension>]
type FSharpOptionExtensions =
    [<Extension>]
    static member HasValue o = Option.isSome o

    [<Extension>]
    static member ToOption (n: Nullable<'a>) =
        if n.HasValue
            then Some n.Value
            else None

    [<Extension>]
    static member Some a = Option.Some a

    // LINQ
    [<Extension>]
    static member Select (o: 'a option, f: Func<'a, 'b>) = Option.map f.Invoke o

    [<Extension>]
    static member SelectMany (o: 'a option, f: Func<'a, 'b option>) = Option.bind f.Invoke o

    [<Extension>]
    static member SelectMany (o: 'a option, f: Func<'a, 'b option>, mapper: Func<'a,'b,'c>) =
        let c = Option.bind f.Invoke o
        match o,c with
        | Some a,Some b -> mapper.Invoke(a,b) |> Some
        | _ -> None

type FSharpOption =
    static member Some a = Option.Some a<commit_msg>some unit<commit_after>﻿namespace FSharp.Core.CS

open System
open System.Runtime.CompilerServices

[<Extension>]
type FSharpOptionExtensions =
    [<Extension>]
    static member HasValue o = Option.isSome o

    [<Extension>]
    static member ToOption (n: Nullable<'a>) =
        if n.HasValue
            then Some n.Value
            else None

    [<Extension>]
    static member Some a = Option.Some a

    // LINQ
    [<Extension>]
    static member Select (o: 'a option, f: Func<'a, 'b>) = Option.map f.Invoke o

    [<Extension>]
    static member SelectMany (o: 'a option, f: Func<'a, 'b option>) = Option.bind f.Invoke o

    [<Extension>]
    static member SelectMany (o: 'a option, f: Func<'a, 'b option>, mapper: Func<'a,'b,'c>) =
        let c = Option.bind f.Invoke o
        match o,c with
        | Some a,Some b -> mapper.Invoke(a,b) |> Some
        | _ -> None

type FSharpOption =
    static member Some a = Option.Some a
    static member SomeUnit = Some()
{'fraction_non_alphanumeric': 0.1272066458982347, 'fraction_numerical': 0.0, 'mean_word_length': 2.5884543761638734, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1273121', 'n_tokens_mistral': 645, 'n_tokens_neox': 624, 'n_words': 202}