-module(fsharp_core).
-compile(nowarn_unused_vars).
-compile(nowarn_unused_function).
-export([language_primitives_generic_equality_comparer/0, language_primitives_generic_equality_e_r_comparer/0, language_primitives_fast_generic_comparer/0, language_primitives_fast_generic_comparer_from_table/0, language_primitives_fast_generic_equality_comparer/0, language_primitives_fast_generic_equality_comparer_from_table/0, operators_failure/1, operators_failure_pattern/1, operators_null_arg/1, operators_using/2, operators_lock/2, operators_is_null/1, operators_is_not_null/1, operators_is_null_v/1, operators_non_null/1, operators_non_null_v/1, operators_null_match_pattern/1, operators_null_value_match_pattern/1, operators_non_null_quick_pattern/1, operators_non_null_quick_value_pattern/1, operators_with_null/1, operators_with_null_v/1, operators_null_v/0, operators_null_arg_check/2, extra_top_level_operators_lazy_pattern/1, printf_module_print_format_to_string_builder_then/3, printf_module_print_format_to_string_builder/2]).

language_primitives_generic_equality_comparer() ->
    #{equals => fun(X, Y) ->
        fable_comparison:equals(X, Y)
end, get_hash_code => fun(X_1) ->
        fable_comparison:hash(X_1)
end}
.

language_primitives_generic_equality_e_r_comparer() ->
    #{equals => fun(X, Y) ->
        fable_comparison:equals(X, Y)
end, get_hash_code => fun(X_1) ->
        fable_comparison:hash(X_1)
end}
.

language_primitives_fast_generic_comparer() ->
    fsharp_collections:comparison_identity_structural()
.

language_primitives_fast_generic_comparer_from_table() ->
    fsharp_collections:comparison_identity_structural()
.

language_primitives_fast_generic_equality_comparer() ->
    fsharp_collections:hash_identity_structural()
.

language_primitives_fast_generic_equality_comparer_from_table() ->
    fsharp_collections:hash_identity_structural()
.

operators_failure(Message) ->
    #{message => Message}
.

operators_failure_pattern(Exn) ->
    (fun() -> case erlang:is_reference(Exn) of true -> maps:get(message, erlang:get(Exn), Exn); false -> maps:get(message, Exn, Exn) end end)()
.

operators_null_arg(ArgumentName) ->
    erlang:error(#{message => ArgumentName})
.

operators_using(Resource, Action) ->
    try
        Action(Resource)
    catch
        _:Exn_reason_0 ->
            erlang:error(Exn_reason_0)
    after
        case fable_comparison:equals(Resource, undefined) of
            true ->
                ok
            ;
            false ->
                begin CopyOfStruct = Resource,
                fable_utils:safe_dispose(CopyOfStruct) end
        end
    end
.

operators_lock(_lockObj, Action) ->
    Action(ok)
.

operators_is_null(Value) ->
    case fable_comparison:equals(Value, undefined) of
        true ->
            true
        ;
        false ->
            false
    end
.

operators_is_not_null(Value) ->
    case fable_comparison:equals(Value, undefined) of
        true ->
            false
        ;
        false ->
            true
    end
.

operators_is_null_v(Value) ->
    not (Value =/= undefined)
.

operators_non_null(Value) ->
    case fable_comparison:equals(Value, undefined) of
        true ->
            erlang:error(#{message => <<"Exception of type 'System.NullReferenceException' was thrown.">>})
        ;
        false ->
            Value
    end
.

operators_non_null_v(Value) ->
    case Value =/= undefined of
        true ->
            Value
        ;
        false ->
            erlang:error(#{message => <<"Exception of type 'System.NullReferenceException' was thrown.">>})
    end
.

operators_null_match_pattern(Value) ->
    case fable_comparison:equals(Value, undefined) of
        true ->
            {choice1_of2, ok}
        ;
        false ->
            {choice2_of2, Value}
    end
.

operators_null_value_match_pattern(Value) ->
    case Value =/= undefined of
        true ->
            {choice2_of2, Value}
        ;
        false ->
            {choice1_of2, ok}
    end
.

operators_non_null_quick_pattern(Value) ->
    case fable_comparison:equals(Value, undefined) of
        true ->
            erlang:error(#{message => <<"Exception of type 'System.NullReferenceException' was thrown.">>})
        ;
        false ->
            Value
    end
.

operators_non_null_quick_value_pattern(Value) ->
    case Value =/= undefined of
        true ->
            Value
        ;
        false ->
            erlang:error(#{message => <<"Exception of type 'System.NullReferenceException' was thrown.">>})
    end
.

operators_with_null(Value) ->
    Value
.

operators_with_null_v(Value) ->
    Value
.

operators_null_v() ->
    undefined
.

operators_null_arg_check(ArgumentName, Value) ->
    case fable_comparison:equals(Value, undefined) of
        true ->
            erlang:error(#{message => ArgumentName})
        ;
        false ->
            Value
    end
.

extra_top_level_operators_lazy_pattern(Input) ->
    fable_utils:force_lazy(Input)
.

printf_module_print_format_to_string_builder_then(Continuation, Builder, Format) ->
    (maps:get(cont, Format))(fun(S) ->
        begin system_text:string_builder_append_z721_c83_c5(Builder, S),
        ok end,
        Continuation(ok)
end)
.

printf_module_print_format_to_string_builder(Builder, Format) ->
    printf_module_print_format_to_string_builder_then(fun(Value) ->
        ok
end, Builder, Format)
.
