// ignore_for_file: camel_case_types, constant_identifier_names, non_constant_identifier_names, unnecessary_this
import './Choice.dart' as choice;
import './System.dart' as system;
import './Types.dart' as types;
import './Util.dart' as util;

abstract class Lazy<$T> {
    $T Force();
}

dynamic Operators_Failure(String message) => types.ExceptionBase(message);

types.Some<String>? Operators_FailurePattern(dynamic exn) => types.Some(exn.toString());

$$a Operators_NullArg<$$a>(String argumentName) => throw system.ArgumentNullException_$ctor_Z721C83C5(argumentName);

$R Operators_Using<$T extends types.IDisposable, $R>($T resource, $R Function($T) action) {
    try {
        return action(resource);
    } finally {
        if (util.equalsDynamic(resource, null)) {
        } else {
            $T copyOfStruct = resource;
            types.dispose(copyOfStruct);
        }
    }
}

$$b Operators_Lock<$$a, $$b>($$a _lockObj, $$b Function() action) => action();

bool Operators_IsNull<$T>($T value) {
    if (util.equalsDynamic(value, null)) {
        return true;
    } else {
        return false;
    }
}

bool Operators_IsNotNull<$T>($T value) {
    if (util.equalsDynamic(value, null)) {
        return false;
    } else {
        return true;
    }
}

bool Operators_IsNullV<$T extends Object>($T? value) => !(value != null);

$T Operators_NonNull<$T>($T value) {
    if (util.equalsDynamic(value, null)) {
        return throw system.NullReferenceException_$ctor();
    } else {
        return value;
    }
}

$T Operators_NonNullV<$T extends Object>($T? value) {
    if (value != null) {
        return util.value(value);
    } else {
        return throw system.NullReferenceException_$ctor();
    }
}

choice.FSharpChoice$2<void, $T> Operators_NullMatchPattern<$T>($T value) {
    if (util.equalsDynamic(value, null)) {
        return choice.FSharpChoice$2_Choice1Of2<void, $T>(null);
    } else {
        return choice.FSharpChoice$2_Choice2Of2<void, $T>(value);
    }
}

choice.FSharpChoice$2<void, $T> Operators_NullValueMatchPattern<$T extends Object>($T? value) {
    if (value != null) {
        return choice.FSharpChoice$2_Choice2Of2<void, $T>(util.value(value));
    } else {
        return choice.FSharpChoice$2_Choice1Of2<void, $T>(null);
    }
}

$T Operators_NonNullQuickPattern<$T>($T value) {
    if (util.equalsDynamic(value, null)) {
        return throw system.NullReferenceException_$ctor();
    } else {
        return value;
    }
}

$T Operators_NonNullQuickValuePattern<$T extends Object>($T? value) {
    if (value != null) {
        return util.value(value);
    } else {
        return throw system.NullReferenceException_$ctor();
    }
}

$T Operators_WithNull<$T>($T value) => value;

$T Operators_WithNullV<$T extends Object>($T value) => value;

$T? Operators_NullV<$T extends Object>() => null;

$T Operators_NullArgCheck<$T>(String argumentName, $T value) {
    if (util.equalsDynamic(value, null)) {
        return throw system.ArgumentNullException_$ctor_Z721C83C5(argumentName);
    } else {
        return value;
    }
}

$$a ExtraTopLevelOperators_LazyPattern<$$a>(Lazy<$$a> input) => input.Force();

