Decompiled source of LanguageExt v0.1.1

BepInEx/plugins/LanguageExt/LanguageExt.Core.dll

Decompiled 11 months ago
using System;
using System.Buffers;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Numerics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using LanguageExt;
using LanguageExt.Attributes;
using LanguageExt.ClassInstances;
using LanguageExt.ClassInstances.Const;
using LanguageExt.ClassInstances.Pred;
using LanguageExt.Common;
using LanguageExt.DataTypes.Serialisation;
using LanguageExt.Effects.Traits;
using LanguageExt.Pipes;
using LanguageExt.TypeClasses;
using LanguageExt.UnitsOfMeasure;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Paul Louth")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright (c) Paul Louth. All rights reserved.")]
[assembly: AssemblyDescription("This library uses and abuses the features of C# to provide a functional 'Base class library', that, if you squint, can look like extensions to the language itself.")]
[assembly: AssemblyFileVersion("4.4.5.0")]
[assembly: AssemblyInformationalVersion("4.4.5-dev.5+d8167ed3491f17e813ed9e9422b0384b15b2982d")]
[assembly: AssemblyProduct("LanguageExt.Core")]
[assembly: AssemblyTitle("LanguageExt.Core")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Lordfirespeed/LanguageExtThunderstore")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsByRefLikeAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public static class CompositionsExt
{
	public static Compositions<A> Cons<MonoidA, A>(this A a, Compositions<A> ma) where MonoidA : struct, Monoid<A>
	{
		return Compositions.cons<MonoidA, A>(a, ma);
	}
}
public static class Tuple1Extensions
{
	[Pure]
	public static Tuple<A, B> Add<A, B>(this Tuple<A> self, B second)
	{
		return Prelude.Tuple(self.Item1, second);
	}

	[Pure]
	public static Tuple<A> Append<SemiA, A>(this Tuple<A> a, Tuple<A> b) where SemiA : struct, Semigroup<A>
	{
		return Prelude.Tuple(default(SemiA).Append(a.Item1, b.Item1));
	}

	[Pure]
	public static Tuple<A> Concat<MonoidA, A>(this Tuple<A> a, Tuple<A> b) where MonoidA : struct, Monoid<A>
	{
		return Prelude.Tuple(TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }));
	}

	[Pure]
	public static A Head<A>(this Tuple<A> self)
	{
		return self.Item1;
	}

	[Pure]
	public static A Last<A>(this Tuple<A> self)
	{
		return self.Item1;
	}

	[Pure]
	public static A Sum<NUM, A>(this Tuple<A> self) where NUM : struct, Num<A>
	{
		return self.Item1;
	}

	[Pure]
	public static A Product<NUM, A>(this Tuple<A> self) where NUM : struct, Num<A>
	{
		return self.Item1;
	}

	[Pure]
	public static bool Contains<EQ, A>(this Tuple<A> self, A value) where EQ : struct, Eq<A>
	{
		return default(EQ).Equals(self.Item1, value);
	}

	[Pure]
	public static Tuple<R> Map<A, R>(this Tuple<A> self, Func<A, R> map)
	{
		return Prelude.Tuple(map(self.Item1));
	}

	[Pure]
	public static Tuple<R> Select<A, R>(this Tuple<A> self, Func<A, R> map)
	{
		return Prelude.Tuple(map(self.Item1));
	}

	public static Unit Iter<A>(this Tuple<A> self, Action<A> func)
	{
		func(self.Item1);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<A, S>(this Tuple<A> self, S state, Func<S, A, S> fold)
	{
		return fold(state, self.Item1);
	}
}
public static class Tuple2Extensions
{
	[Pure]
	public static Tuple<A, B, C> add<A, B, C>(this Tuple<A, B> self, C third)
	{
		return Prelude.Tuple(self.Item1, self.Item2, third);
	}

	[Pure]
	public static Tuple<A, B> Append<SemiA, SemiB, A, B>(this Tuple<A, B> a, Tuple<A, B> b) where SemiA : struct, Semigroup<A> where SemiB : struct, Semigroup<B>
	{
		return Prelude.Tuple(default(SemiA).Append(a.Item1, b.Item1), default(SemiB).Append(a.Item2, b.Item2));
	}

	[Pure]
	public static A Append<SemiA, A>(this Tuple<A, A> a) where SemiA : struct, Semigroup<A>
	{
		return default(SemiA).Append(a.Item1, a.Item2);
	}

	[Pure]
	public static Tuple<A, B> Concat<MonoidA, MonoidB, A, B>(this Tuple<A, B> a, Tuple<A, B> b) where MonoidA : struct, Monoid<A> where MonoidB : struct, Monoid<B>
	{
		return Prelude.Tuple(TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }), TypeClass.mconcat<MonoidB, B>(new B[2] { a.Item2, b.Item2 }));
	}

	[Pure]
	public static A Concat<MonoidA, A>(this Tuple<A, A> a) where MonoidA : struct, Monoid<A>
	{
		return TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, a.Item2 });
	}

	[Pure]
	public static T1 Head<T1, T2>(this Tuple<T1, T2> self)
	{
		return self.Item1;
	}

	[Pure]
	public static T2 Last<T1, T2>(this Tuple<T1, T2> self)
	{
		return self.Item2;
	}

	[Pure]
	public static Tuple<T2> Tail<T1, T2>(this Tuple<T1, T2> self)
	{
		return Prelude.Tuple(self.Item2);
	}

	[Pure]
	public static A Sum<NUM, A>(this Tuple<A, A> self) where NUM : struct, Num<A>
	{
		return TypeClass.sum<NUM, FoldTuple<A>, Tuple<A, A>, A>(self);
	}

	[Pure]
	public static A Product<NUM, A>(this Tuple<A, A> self) where NUM : struct, Num<A>
	{
		return TypeClass.product<NUM, FoldTuple<A>, Tuple<A, A>, A>(self);
	}

	[Pure]
	public static bool Contains<EQ, A>(this Tuple<A, A> self, A value) where EQ : struct, Eq<A>
	{
		return TypeClass.contains<EQ, FoldTuple<A>, Tuple<A, A>, A>(self, value);
	}

	[Pure]
	public static R Map<T1, T2, R>(this Tuple<T1, T2> self, Func<T1, T2, R> map)
	{
		return map(self.Item1, self.Item2);
	}

	[Pure]
	public static R Map<A, B, R>(this Tuple<A, B> self, Func<Tuple<A, B>, R> map)
	{
		return map(self);
	}

	[Pure]
	public static Tuple<Y, Z> Map<A, B, Y, Z>(this Tuple<A, B> self, Func<A, B, Tuple<Y, Z>> map)
	{
		return map(self.Item1, self.Item2);
	}

	[Pure]
	public static Tuple<R1, R2> Map<T1, T2, R1, R2>(this Tuple<T1, T2> self, Func<Tuple<T1, T2>, Tuple<R1, R2>> map)
	{
		return map(self);
	}

	[Pure]
	public static Tuple<R1, R2> BiMap<T1, T2, R1, R2>(this Tuple<T1, T2> self, Func<T1, R1> firstMap, Func<T2, R2> secondMap)
	{
		return Prelude.Tuple(firstMap(self.Item1), secondMap(self.Item2));
	}

	[Pure]
	public static Tuple<R1, T2> MapFirst<T1, T2, R1>(this Tuple<T1, T2> self, Func<T1, R1> firstMap)
	{
		return Prelude.Tuple(firstMap(self.Item1), self.Item2);
	}

	[Pure]
	public static Tuple<T1, R2> MapSecond<T1, T2, R2>(this Tuple<T1, T2> self, Func<T2, R2> secondMap)
	{
		return Prelude.Tuple(self.Item1, secondMap(self.Item2));
	}

	[Pure]
	public static Tuple<R1, R2> Select<T1, T2, R1, R2>(this Tuple<T1, T2> self, Func<Tuple<T1, T2>, Tuple<R1, R2>> map)
	{
		return map(self);
	}

	public static Unit Iter<T1, T2>(this Tuple<T1, T2> self, Action<T1, T2> func)
	{
		func(self.Item1, self.Item2);
		return Unit.Default;
	}

	public static Unit Iter<T1, T2>(this Tuple<T1, T2> self, Action<T1> first, Action<T2> second)
	{
		first(self.Item1);
		second(self.Item2);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<T1, T2, S>(this Tuple<T1, T2> self, S state, Func<S, T1, T2, S> fold)
	{
		return fold(state, self.Item1, self.Item2);
	}

	[Pure]
	public static S BiFold<T1, T2, S>(this Tuple<T1, T2> self, S state, Func<S, T1, S> firstFold, Func<S, T2, S> secondFold)
	{
		return secondFold(firstFold(state, self.Item1), self.Item2);
	}

	[Pure]
	public static S BiFoldBack<T1, T2, S>(this Tuple<T1, T2> self, S state, Func<S, T2, S> firstFold, Func<S, T1, S> secondFold)
	{
		return secondFold(firstFold(state, self.Item2), self.Item1);
	}
}
public static class Tuple3Extensions
{
	[Pure]
	public static Tuple<T1, T2, T3, T4> Add<T1, T2, T3, T4>(this Tuple<T1, T2, T3> self, T4 fourth)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, fourth);
	}

	[Pure]
	public static Tuple<A, B, C> Append<SemiA, SemiB, SemiC, A, B, C>(this Tuple<A, B, C> a, Tuple<A, B, C> b) where SemiA : struct, Semigroup<A> where SemiB : struct, Semigroup<B> where SemiC : struct, Semigroup<C>
	{
		return Prelude.Tuple(default(SemiA).Append(a.Item1, b.Item1), default(SemiB).Append(a.Item2, b.Item2), default(SemiC).Append(a.Item3, b.Item3));
	}

	[Pure]
	public static A Append<SemiA, A>(this Tuple<A, A, A> a) where SemiA : struct, Semigroup<A>
	{
		return default(SemiA).Append(a.Item1, default(SemiA).Append(a.Item2, a.Item3));
	}

	[Pure]
	public static Tuple<A, B, C> Concat<MonoidA, MonoidB, MonoidC, A, B, C>(this Tuple<A, B, C> a, Tuple<A, B, C> b) where MonoidA : struct, Monoid<A> where MonoidB : struct, Monoid<B> where MonoidC : struct, Monoid<C>
	{
		return Prelude.Tuple(TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }), TypeClass.mconcat<MonoidB, B>(new B[2] { a.Item2, b.Item2 }), TypeClass.mconcat<MonoidC, C>(new C[2] { a.Item3, b.Item3 }));
	}

	[Pure]
	public static A Concat<MonoidA, A>(this Tuple<A, A, A> a) where MonoidA : struct, Monoid<A>
	{
		return TypeClass.mconcat<MonoidA, A>(new A[3] { a.Item1, a.Item2, a.Item3 });
	}

	[Pure]
	public static T1 Head<T1, T2, T3>(this Tuple<T1, T2, T3> self)
	{
		return self.Item1;
	}

	[Pure]
	public static T3 Last<T1, T2, T3>(this Tuple<T1, T2, T3> self)
	{
		return self.Item3;
	}

	[Pure]
	public static Tuple<T2, T3> Tail<T1, T2, T3>(this Tuple<T1, T2, T3> self)
	{
		return Prelude.Tuple(self.Item2, self.Item3);
	}

	[Pure]
	public static A Sum<NUM, A>(this Tuple<A, A, A> self) where NUM : struct, Num<A>
	{
		return default(NUM).Plus(self.Item1, default(NUM).Plus(self.Item2, self.Item3));
	}

	[Pure]
	public static A Product<NUM, A>(this Tuple<A, A, A> self) where NUM : struct, Num<A>
	{
		return default(NUM).Product(self.Item1, default(NUM).Product(self.Item2, self.Item3));
	}

	[Pure]
	public static bool Contains<EQ, A>(this Tuple<A, A, A> self, A value) where EQ : struct, Eq<A>
	{
		if (!default(EQ).Equals(self.Item1, value) && !default(EQ).Equals(self.Item2, value))
		{
			return default(EQ).Equals(self.Item3, value);
		}
		return true;
	}

	[Pure]
	public static R Map<A, B, C, R>(this Tuple<A, B, C> self, Func<Tuple<A, B, C>, R> map)
	{
		return map(self);
	}

	[Pure]
	public static R Map<A, B, C, R>(this Tuple<A, B, C> self, Func<A, B, C, R> map)
	{
		return map(self.Item1, self.Item2, self.Item3);
	}

	[Pure]
	public static Tuple<X, Y, Z> Map<A, B, C, X, Y, Z>(this Tuple<A, B, C> self, Func<A, B, C, Tuple<X, Y, Z>> map)
	{
		return map(self.Item1, self.Item2, self.Item3);
	}

	[Pure]
	public static Tuple<R1, R2, R3> Map<T1, T2, T3, R1, R2, R3>(this Tuple<T1, T2, T3> self, Func<T1, R1> firstMap, Func<T2, R2> secondMap, Func<T3, R3> thirdMap)
	{
		return Prelude.Tuple(firstMap(self.Item1), secondMap(self.Item2), thirdMap(self.Item3));
	}

	[Pure]
	public static Tuple<R1, T2, T3> MapFirst<T1, T2, T3, R1>(this Tuple<T1, T2, T3> self, Func<T1, R1> firstMap)
	{
		return Prelude.Tuple(firstMap(self.Item1), self.Item2, self.Item3);
	}

	[Pure]
	public static Tuple<T1, R2, T3> MapSecond<T1, T2, T3, R2>(this Tuple<T1, T2, T3> self, Func<T2, R2> secondMap)
	{
		return Prelude.Tuple(self.Item1, secondMap(self.Item2), self.Item3);
	}

	[Pure]
	public static Tuple<T1, T2, R3> MapThird<T1, T2, T3, R3>(this Tuple<T1, T2, T3> self, Func<T3, R3> thirdMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, thirdMap(self.Item3));
	}

	[Pure]
	public static Tuple<R1, R2, R3> Select<T1, T2, T3, R1, R2, R3>(this Tuple<T1, T2, T3> self, Func<Tuple<T1, T2, T3>, Tuple<R1, R2, R3>> map)
	{
		return map(self);
	}

	public static Unit Iter<T1, T2, T3>(this Tuple<T1, T2, T3> self, Action<T1, T2, T3> func)
	{
		func(self.Item1, self.Item2, self.Item3);
		return Unit.Default;
	}

	public static Unit Iter<T1, T2, T3>(this Tuple<T1, T2, T3> self, Action<T1> first, Action<T2> second, Action<T3> third)
	{
		first(self.Item1);
		second(self.Item2);
		third(self.Item3);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<T1, T2, T3, S>(this Tuple<T1, T2, T3> self, S state, Func<S, T1, T2, T3, S> fold)
	{
		return fold(state, self.Item1, self.Item2, self.Item3);
	}

	[Pure]
	public static S TriFold<T1, T2, T3, S>(this Tuple<T1, T2, T3> self, S state, Func<S, T1, S> firstFold, Func<S, T2, S> secondFold, Func<S, T3, S> thirdFold)
	{
		return thirdFold(secondFold(firstFold(state, self.Item1), self.Item2), self.Item3);
	}

	[Pure]
	public static S TriFoldBack<T1, T2, T3, S>(this Tuple<T1, T2, T3> self, S state, Func<S, T3, S> firstFold, Func<S, T2, S> secondFold, Func<S, T1, S> thirdFold)
	{
		return thirdFold(secondFold(firstFold(state, self.Item3), self.Item2), self.Item1);
	}
}
public static class Tuple4Extensions
{
	[Pure]
	public static Tuple<A, B, C, D, E> Add<A, B, C, D, E>(this Tuple<A, B, C, D> self, E fifth)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, self.Item4, fifth);
	}

	[Pure]
	public static Tuple<A, B, C, D> Append<SemiA, SemiB, SemiC, SemiD, A, B, C, D>(this Tuple<A, B, C, D> a, Tuple<A, B, C, D> b) where SemiA : struct, Semigroup<A> where SemiB : struct, Semigroup<B> where SemiC : struct, Semigroup<C> where SemiD : struct, Semigroup<D>
	{
		return Prelude.Tuple(default(SemiA).Append(a.Item1, b.Item1), default(SemiB).Append(a.Item2, b.Item2), default(SemiC).Append(a.Item3, b.Item3), default(SemiD).Append(a.Item4, b.Item4));
	}

	[Pure]
	public static A Append<SemiA, A>(this Tuple<A, A, A, A> a) where SemiA : struct, Semigroup<A>
	{
		return default(SemiA).Append(a.Item1, default(SemiA).Append(a.Item2, default(SemiA).Append(a.Item3, a.Item4)));
	}

	[Pure]
	public static Tuple<A, B, C, D> Concat<MonoidA, MonoidB, MonoidC, MonoidD, A, B, C, D>(this Tuple<A, B, C, D> a, Tuple<A, B, C, D> b) where MonoidA : struct, Monoid<A> where MonoidB : struct, Monoid<B> where MonoidC : struct, Monoid<C> where MonoidD : struct, Monoid<D>
	{
		return Prelude.Tuple(TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }), TypeClass.mconcat<MonoidB, B>(new B[2] { a.Item2, b.Item2 }), TypeClass.mconcat<MonoidC, C>(new C[2] { a.Item3, b.Item3 }), TypeClass.mconcat<MonoidD, D>(new D[2] { a.Item4, b.Item4 }));
	}

	[Pure]
	public static A Concat<MonoidA, A>(this Tuple<A, A, A, A> a) where MonoidA : struct, Monoid<A>
	{
		return TypeClass.mconcat<MonoidA, A>(new A[4] { a.Item1, a.Item2, a.Item3, a.Item4 });
	}

	[Pure]
	public static A Head<A, B, C, D>(this Tuple<A, B, C, D> self)
	{
		return self.Item1;
	}

	[Pure]
	public static D Last<A, B, C, D>(this Tuple<A, B, C, D> self)
	{
		return self.Item4;
	}

	[Pure]
	public static Tuple<B, C, D> Tail<A, B, C, D>(this Tuple<A, B, C, D> self)
	{
		return Prelude.Tuple(self.Item2, self.Item3, self.Item4);
	}

	[Pure]
	public static A Sum<NUM, A>(this Tuple<A, A, A, A> self) where NUM : struct, Num<A>
	{
		return TypeClass.sum<NUM, FoldTuple<A>, Tuple<A, A, A, A>, A>(self);
	}

	[Pure]
	public static A Product<NUM, A>(this Tuple<A, A, A, A> self) where NUM : struct, Num<A>
	{
		return TypeClass.product<NUM, FoldTuple<A>, Tuple<A, A, A, A>, A>(self);
	}

	[Pure]
	public static bool Contains<EQ, A>(this Tuple<A, A, A, A> self, A value) where EQ : struct, Eq<A>
	{
		if (!default(EQ).Equals(self.Item1, value) && !default(EQ).Equals(self.Item2, value) && !default(EQ).Equals(self.Item3, value))
		{
			return default(EQ).Equals(self.Item4, value);
		}
		return true;
	}

	[Pure]
	public static R Map<A, B, C, D, R>(this Tuple<A, B, C, D> self, Func<Tuple<A, B, C, D>, R> map)
	{
		return map(self);
	}

	[Pure]
	public static R Map<A, B, C, D, R>(this Tuple<A, B, C, D> self, Func<A, B, C, D, R> map)
	{
		return map(self.Item1, self.Item2, self.Item3, self.Item4);
	}

	[Pure]
	public static Tuple<W, X, Y, Z> Map<A, B, C, D, W, X, Y, Z>(this Tuple<A, B, C, D> self, Func<A, W> firstMap, Func<B, X> secondMap, Func<C, Y> thirdMap, Func<D, Z> fourthMap)
	{
		return Prelude.Tuple(firstMap(self.Item1), secondMap(self.Item2), thirdMap(self.Item3), fourthMap(self.Item4));
	}

	[Pure]
	public static Tuple<R1, B, C, D> MapFirst<A, B, C, D, R1>(this Tuple<A, B, C, D> self, Func<A, R1> firstMap)
	{
		return Prelude.Tuple(firstMap(self.Item1), self.Item2, self.Item3, self.Item4);
	}

	[Pure]
	public static Tuple<A, R2, C, D> MapSecond<A, B, C, D, R2>(this Tuple<A, B, C, D> self, Func<B, R2> secondMap)
	{
		return Prelude.Tuple(self.Item1, secondMap(self.Item2), self.Item3, self.Item4);
	}

	[Pure]
	public static Tuple<A, B, R3, D> MapThird<A, B, C, D, R3>(this Tuple<A, B, C, D> self, Func<C, R3> thirdMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, thirdMap(self.Item3), self.Item4);
	}

	[Pure]
	public static Tuple<A, B, C, R4> MapFourth<A, B, C, D, R4>(this Tuple<A, B, C, D> self, Func<D, R4> fourthMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, fourthMap(self.Item4));
	}

	[Pure]
	public static Tuple<W, X, Y, Z> Select<A, B, C, D, W, X, Y, Z>(this Tuple<A, B, C, D> self, Func<Tuple<A, B, C, D>, Tuple<W, X, Y, Z>> map)
	{
		return map(self);
	}

	public static Unit Iter<A, B, C, D>(this Tuple<A, B, C, D> self, Action<A, B, C, D> func)
	{
		func(self.Item1, self.Item2, self.Item3, self.Item4);
		return Unit.Default;
	}

	public static Unit Iter<A, B, C, D>(this Tuple<A, B, C, D> self, Action<A> first, Action<B> second, Action<C> third, Action<D> fourth)
	{
		first(self.Item1);
		second(self.Item2);
		third(self.Item3);
		fourth(self.Item4);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<A, B, C, D, S>(this Tuple<A, B, C, D> self, S state, Func<S, A, B, C, D, S> fold)
	{
		return fold(state, self.Item1, self.Item2, self.Item3, self.Item4);
	}

	[Pure]
	public static S QuadFold<A, B, C, D, S>(this Tuple<A, B, C, D> self, S state, Func<S, A, S> firstFold, Func<S, B, S> secondFold, Func<S, C, S> thirdFold, Func<S, D, S> fourthFold)
	{
		return fourthFold(thirdFold(secondFold(firstFold(state, self.Item1), self.Item2), self.Item3), self.Item4);
	}

	[Pure]
	public static S QuadFoldBack<A, B, C, D, S>(this Tuple<A, B, C, D> self, S state, Func<S, D, S> firstFold, Func<S, C, S> secondFold, Func<S, B, S> thirdFold, Func<S, A, S> fourthFold)
	{
		return fourthFold(thirdFold(secondFold(firstFold(state, self.Item4), self.Item3), self.Item2), self.Item1);
	}
}
public static class Tuple5Extensions
{
	[Pure]
	public static Tuple<A, B, C, D, E, F> Add<A, B, C, D, E, F>(this Tuple<A, B, C, D, E> self, F sixth)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, sixth);
	}

	[Pure]
	public static Tuple<A, B, C, D, E> Append<SemiA, SemiB, SemiC, SemiD, SemiE, A, B, C, D, E>(this Tuple<A, B, C, D, E> a, Tuple<A, B, C, D, E> b) where SemiA : struct, Semigroup<A> where SemiB : struct, Semigroup<B> where SemiC : struct, Semigroup<C> where SemiD : struct, Semigroup<D> where SemiE : struct, Semigroup<E>
	{
		return Prelude.Tuple(default(SemiA).Append(a.Item1, b.Item1), default(SemiB).Append(a.Item2, b.Item2), default(SemiC).Append(a.Item3, b.Item3), default(SemiD).Append(a.Item4, b.Item4), default(SemiE).Append(a.Item5, b.Item5));
	}

	[Pure]
	public static A Append<SemiA, A>(this Tuple<A, A, A, A, A> a) where SemiA : struct, Semigroup<A>
	{
		return default(SemiA).Append(a.Item1, default(SemiA).Append(a.Item2, default(SemiA).Append(a.Item3, default(SemiA).Append(a.Item4, a.Item5))));
	}

	[Pure]
	public static Tuple<A, B, C, D, E> Concat<MonoidA, MonoidB, MonoidC, MonoidD, MonoidE, A, B, C, D, E>(this Tuple<A, B, C, D, E> a, Tuple<A, B, C, D, E> b) where MonoidA : struct, Monoid<A> where MonoidB : struct, Monoid<B> where MonoidC : struct, Monoid<C> where MonoidD : struct, Monoid<D> where MonoidE : struct, Monoid<E>
	{
		return Prelude.Tuple(TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }), TypeClass.mconcat<MonoidB, B>(new B[2] { a.Item2, b.Item2 }), TypeClass.mconcat<MonoidC, C>(new C[2] { a.Item3, b.Item3 }), TypeClass.mconcat<MonoidD, D>(new D[2] { a.Item4, b.Item4 }), TypeClass.mconcat<MonoidE, E>(new E[2] { a.Item5, b.Item5 }));
	}

	[Pure]
	public static A Concat<MonoidA, A>(this Tuple<A, A, A, A, A> a) where MonoidA : struct, Monoid<A>
	{
		return TypeClass.mconcat<MonoidA, A>(new A[5] { a.Item1, a.Item2, a.Item3, a.Item4, a.Item5 });
	}

	[Pure]
	public static A Head<A, B, C, D, E>(this Tuple<A, B, C, D, E> self)
	{
		return self.Item1;
	}

	[Pure]
	public static E Last<A, B, C, D, E>(this Tuple<A, B, C, D, E> self)
	{
		return self.Item5;
	}

	[Pure]
	public static Tuple<B, C, D, E> Tail<A, B, C, D, E>(this Tuple<A, B, C, D, E> self)
	{
		return Prelude.Tuple(self.Item2, self.Item3, self.Item4, self.Item5);
	}

	[Pure]
	public static A Sum<NUM, A>(this Tuple<A, A, A, A, A> self) where NUM : struct, Num<A>
	{
		return TypeClass.sum<NUM, FoldTuple<A>, Tuple<A, A, A, A, A>, A>(self);
	}

	[Pure]
	public static A Product<NUM, A>(this Tuple<A, A, A, A, A> self) where NUM : struct, Num<A>
	{
		return TypeClass.product<NUM, FoldTuple<A>, Tuple<A, A, A, A, A>, A>(self);
	}

	[Pure]
	public static bool Contains<EQ, A>(this Tuple<A, A, A, A, A> self, A value) where EQ : struct, Eq<A>
	{
		if (!default(EQ).Equals(self.Item1, value) && !default(EQ).Equals(self.Item2, value) && !default(EQ).Equals(self.Item3, value) && !default(EQ).Equals(self.Item4, value))
		{
			return default(EQ).Equals(self.Item5, value);
		}
		return true;
	}

	[Pure]
	public static R Map<A, B, C, D, E, R>(this Tuple<A, B, C, D, E> self, Func<Tuple<A, B, C, D, E>, R> map)
	{
		return map(self);
	}

	[Pure]
	public static R Map<A, B, C, D, E, R>(this Tuple<A, B, C, D, E> self, Func<A, B, C, D, E, R> map)
	{
		return map(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5);
	}

	[Pure]
	public static Tuple<V, W, X, Y, Z> Map<A, B, C, D, E, V, W, X, Y, Z>(this Tuple<A, B, C, D, E> self, Func<A, B, C, D, E, Tuple<V, W, X, Y, Z>> map)
	{
		return map(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5);
	}

	[Pure]
	public static Tuple<V, W, X, Y, Z> Map<A, B, C, D, E, V, W, X, Y, Z>(this Tuple<A, B, C, D, E> self, Func<A, V> firstMap, Func<B, W> secondMap, Func<C, X> thirdMap, Func<D, Y> fourthMap, Func<E, Z> fifthMap)
	{
		return Prelude.Tuple(firstMap(self.Item1), secondMap(self.Item2), thirdMap(self.Item3), fourthMap(self.Item4), fifthMap(self.Item5));
	}

	[Pure]
	public static Tuple<R1, B, C, D, E> MapFirst<A, B, C, D, E, R1>(this Tuple<A, B, C, D, E> self, Func<A, R1> firstMap)
	{
		return Prelude.Tuple(firstMap(self.Item1), self.Item2, self.Item3, self.Item4, self.Item5);
	}

	[Pure]
	public static Tuple<A, R2, C, D, E> MapSecond<A, B, C, D, E, R2>(this Tuple<A, B, C, D, E> self, Func<B, R2> secondMap)
	{
		return Prelude.Tuple(self.Item1, secondMap(self.Item2), self.Item3, self.Item4, self.Item5);
	}

	[Pure]
	public static Tuple<A, B, R3, D, E> MapThird<A, B, C, D, E, R3>(this Tuple<A, B, C, D, E> self, Func<C, R3> thirdMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, thirdMap(self.Item3), self.Item4, self.Item5);
	}

	[Pure]
	public static Tuple<A, B, C, R4, E> MapFourth<A, B, C, D, E, R4>(this Tuple<A, B, C, D, E> self, Func<D, R4> fourthMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, fourthMap(self.Item4), self.Item5);
	}

	[Pure]
	public static Tuple<A, B, C, D, R5> MapFifth<A, B, C, D, E, R5>(this Tuple<A, B, C, D, E> self, Func<E, R5> fifthMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, self.Item4, fifthMap(self.Item5));
	}

	[Pure]
	public static Tuple<V, W, X, Y, Z> Select<A, B, C, D, E, V, W, X, Y, Z>(this Tuple<A, B, C, D, E> self, Func<Tuple<A, B, C, D, E>, Tuple<V, W, X, Y, Z>> map)
	{
		return map(self);
	}

	public static Unit Iter<A, B, C, D, E>(this Tuple<A, B, C, D, E> self, Action<A, B, C, D, E> func)
	{
		func(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5);
		return Unit.Default;
	}

	public static Unit Iter<A, B, C, D, E>(this Tuple<A, B, C, D, E> self, Action<A> first, Action<B> second, Action<C> third, Action<D> fourth, Action<E> fifth)
	{
		first(self.Item1);
		second(self.Item2);
		third(self.Item3);
		fourth(self.Item4);
		fifth(self.Item5);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<A, B, C, D, E, S>(this Tuple<A, B, C, D, E> self, S state, Func<S, A, B, C, D, E, S> fold)
	{
		return fold(state, self.Item1, self.Item2, self.Item3, self.Item4, self.Item5);
	}

	[Pure]
	public static S QuintFold<A, B, C, D, E, S>(this Tuple<A, B, C, D, E> self, S state, Func<S, A, S> firstFold, Func<S, B, S> secondFold, Func<S, C, S> thirdFold, Func<S, D, S> fourthFold, Func<S, E, S> fifthFold)
	{
		return fifthFold(fourthFold(thirdFold(secondFold(firstFold(state, self.Item1), self.Item2), self.Item3), self.Item4), self.Item5);
	}

	[Pure]
	public static S QuintFoldBack<A, B, C, D, E, S>(this Tuple<A, B, C, D, E> self, S state, Func<S, E, S> firstFold, Func<S, D, S> secondFold, Func<S, C, S> thirdFold, Func<S, B, S> fourthFold, Func<S, A, S> fifthFold)
	{
		return fifthFold(fourthFold(thirdFold(secondFold(firstFold(state, self.Item5), self.Item4), self.Item3), self.Item2), self.Item1);
	}
}
public static class Tuple6Extensions
{
	[Pure]
	public static Tuple<A, B, C, D, E, F, G> Add<A, B, C, D, E, F, G>(this Tuple<A, B, C, D, E, F> self, G seventh)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, seventh);
	}

	[Pure]
	public static Tuple<A, B, C, D, E, F> Append<SemiA, SemiB, SemiC, SemiD, SemiE, SemiF, A, B, C, D, E, F>(this Tuple<A, B, C, D, E, F> a, Tuple<A, B, C, D, E, F> b) where SemiA : struct, Semigroup<A> where SemiB : struct, Semigroup<B> where SemiC : struct, Semigroup<C> where SemiD : struct, Semigroup<D> where SemiE : struct, Semigroup<E> where SemiF : struct, Semigroup<F>
	{
		return Prelude.Tuple(default(SemiA).Append(a.Item1, b.Item1), default(SemiB).Append(a.Item2, b.Item2), default(SemiC).Append(a.Item3, b.Item3), default(SemiD).Append(a.Item4, b.Item4), default(SemiE).Append(a.Item5, b.Item5), default(SemiF).Append(a.Item6, b.Item6));
	}

	[Pure]
	public static A Append<SemiA, A>(this Tuple<A, A, A, A, A, A> a) where SemiA : struct, Semigroup<A>
	{
		return default(SemiA).Append(a.Item1, default(SemiA).Append(a.Item2, default(SemiA).Append(a.Item3, default(SemiA).Append(a.Item4, default(SemiA).Append(a.Item5, a.Item6)))));
	}

	[Pure]
	public static Tuple<A, B, C, D, E, F> Concat<MonoidA, MonoidB, MonoidC, MonoidD, MonoidE, MonoidF, A, B, C, D, E, F>(this Tuple<A, B, C, D, E, F> a, Tuple<A, B, C, D, E, F> b) where MonoidA : struct, Monoid<A> where MonoidB : struct, Monoid<B> where MonoidC : struct, Monoid<C> where MonoidD : struct, Monoid<D> where MonoidE : struct, Monoid<E> where MonoidF : struct, Monoid<F>
	{
		return Prelude.Tuple(TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }), TypeClass.mconcat<MonoidB, B>(new B[2] { a.Item2, b.Item2 }), TypeClass.mconcat<MonoidC, C>(new C[2] { a.Item3, b.Item3 }), TypeClass.mconcat<MonoidD, D>(new D[2] { a.Item4, b.Item4 }), TypeClass.mconcat<MonoidE, E>(new E[2] { a.Item5, b.Item5 }), TypeClass.mconcat<MonoidF, F>(new F[2] { a.Item6, b.Item6 }));
	}

	[Pure]
	public static A Concat<MonoidA, A>(this Tuple<A, A, A, A, A, A> a) where MonoidA : struct, Monoid<A>
	{
		return TypeClass.mconcat<MonoidA, A>(new A[6] { a.Item1, a.Item2, a.Item3, a.Item4, a.Item5, a.Item6 });
	}

	[Pure]
	public static A Head<A, B, C, D, E, F>(this Tuple<A, B, C, D, E, F> self)
	{
		return self.Item1;
	}

	[Pure]
	public static F Last<A, B, C, D, E, F>(this Tuple<A, B, C, D, E, F> self)
	{
		return self.Item6;
	}

	[Pure]
	public static Tuple<B, C, D, E, F> Tail<A, B, C, D, E, F>(this Tuple<A, B, C, D, E, F> self)
	{
		return Prelude.Tuple(self.Item2, self.Item3, self.Item4, self.Item5, self.Item6);
	}

	[Pure]
	public static A Sum<NUM, A>(this Tuple<A, A, A, A, A, A> self) where NUM : struct, Num<A>
	{
		return TypeClass.sum<NUM, FoldTuple<A>, Tuple<A, A, A, A, A, A>, A>(self);
	}

	[Pure]
	public static A Product<NUM, A>(this Tuple<A, A, A, A, A, A> self) where NUM : struct, Num<A>
	{
		return TypeClass.product<NUM, FoldTuple<A>, Tuple<A, A, A, A, A, A>, A>(self);
	}

	[Pure]
	public static bool Contains<EQ, A>(this Tuple<A, A, A, A, A, A> self, A value) where EQ : struct, Eq<A>
	{
		if (!default(EQ).Equals(self.Item1, value) && !default(EQ).Equals(self.Item2, value) && !default(EQ).Equals(self.Item3, value) && !default(EQ).Equals(self.Item4, value) && !default(EQ).Equals(self.Item5, value))
		{
			return default(EQ).Equals(self.Item6, value);
		}
		return true;
	}

	[Pure]
	public static R Map<A, B, C, D, E, F, R>(this Tuple<A, B, C, D, E, F> self, Func<Tuple<A, B, C, D, E, F>, R> map)
	{
		return map(self);
	}

	[Pure]
	public static R Map<A, B, C, D, E, F, R>(this Tuple<A, B, C, D, E, F> self, Func<A, B, C, D, E, F, R> map)
	{
		return map(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6);
	}

	[Pure]
	public static Tuple<U, V, W, X, Y, Z> Map<A, B, C, D, E, F, U, V, W, X, Y, Z>(this Tuple<A, B, C, D, E, F> self, Func<A, B, C, D, E, F, Tuple<U, V, W, X, Y, Z>> map)
	{
		return map(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6);
	}

	[Pure]
	public static Tuple<U, V, W, X, Y, Z> Map<A, B, C, D, E, F, U, V, W, X, Y, Z>(this Tuple<A, B, C, D, E, F> self, Func<A, U> firstMap, Func<B, V> secondMap, Func<C, W> thirdMap, Func<D, X> fourthMap, Func<E, Y> fifthMap, Func<F, Z> sixthMap)
	{
		return Prelude.Tuple(firstMap(self.Item1), secondMap(self.Item2), thirdMap(self.Item3), fourthMap(self.Item4), fifthMap(self.Item5), sixthMap(self.Item6));
	}

	[Pure]
	public static Tuple<R1, B, C, D, E, F> MapFirst<A, B, C, D, E, F, R1>(this Tuple<A, B, C, D, E, F> self, Func<A, R1> firstMap)
	{
		return Prelude.Tuple(firstMap(self.Item1), self.Item2, self.Item3, self.Item4, self.Item5, self.Item6);
	}

	[Pure]
	public static Tuple<A, R2, C, D, E, F> MapSecond<A, B, C, D, E, F, R2>(this Tuple<A, B, C, D, E, F> self, Func<B, R2> secondMap)
	{
		return Prelude.Tuple(self.Item1, secondMap(self.Item2), self.Item3, self.Item4, self.Item5, self.Item6);
	}

	[Pure]
	public static Tuple<A, B, R3, D, E, F> MapThird<A, B, C, D, E, F, R3>(this Tuple<A, B, C, D, E, F> self, Func<C, R3> thirdMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, thirdMap(self.Item3), self.Item4, self.Item5, self.Item6);
	}

	[Pure]
	public static Tuple<A, B, C, R4, E, F> MapFourth<A, B, C, D, E, F, R4>(this Tuple<A, B, C, D, E, F> self, Func<D, R4> fourthMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, fourthMap(self.Item4), self.Item5, self.Item6);
	}

	[Pure]
	public static Tuple<A, B, C, D, R5, F> MapFifth<A, B, C, D, E, F, R5>(this Tuple<A, B, C, D, E, F> self, Func<E, R5> fifthMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, self.Item4, fifthMap(self.Item5), self.Item6);
	}

	[Pure]
	public static Tuple<A, B, C, D, E, R6> MapSixth<A, B, C, D, E, F, R6>(this Tuple<A, B, C, D, E, F> self, Func<F, R6> sixthMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, sixthMap(self.Item6));
	}

	[Pure]
	public static Tuple<U, V, W, X, Y, Z> Select<A, B, C, D, E, F, U, V, W, X, Y, Z>(this Tuple<A, B, C, D, E, F> self, Func<Tuple<A, B, C, D, E, F>, Tuple<U, V, W, X, Y, Z>> map)
	{
		return map(self);
	}

	public static Unit Iter<A, B, C, D, E, F>(this Tuple<A, B, C, D, E, F> self, Action<A, B, C, D, E, F> func)
	{
		func(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6);
		return Unit.Default;
	}

	public static Unit Iter<A, B, C, D, E, F>(this Tuple<A, B, C, D, E, F> self, Action<A> first, Action<B> second, Action<C> third, Action<D> fourth, Action<E> fifth, Action<F> sixth)
	{
		first(self.Item1);
		second(self.Item2);
		third(self.Item3);
		fourth(self.Item4);
		fifth(self.Item5);
		sixth(self.Item6);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<A, B, C, D, E, F, S>(this Tuple<A, B, C, D, E, F> self, S state, Func<S, A, B, C, D, E, F, S> fold)
	{
		return fold(state, self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6);
	}

	[Pure]
	public static S SextFold<A, B, C, D, E, F, S>(this Tuple<A, B, C, D, E, F> self, S state, Func<S, A, S> firstFold, Func<S, B, S> secondFold, Func<S, C, S> thirdFold, Func<S, D, S> fourthFold, Func<S, E, S> fifthFold, Func<S, F, S> sixthFold)
	{
		return sixthFold(fifthFold(fourthFold(thirdFold(secondFold(firstFold(state, self.Item1), self.Item2), self.Item3), self.Item4), self.Item5), self.Item6);
	}

	[Pure]
	public static S SextFoldBack<A, B, C, D, E, F, S>(this Tuple<A, B, C, D, E, F> self, S state, Func<S, F, S> firstFold, Func<S, E, S> secondFold, Func<S, D, S> thirdFold, Func<S, C, S> fourthFold, Func<S, B, S> fifthFold, Func<S, A, S> sixthFold)
	{
		return sixthFold(fifthFold(fourthFold(thirdFold(secondFold(firstFold(state, self.Item6), self.Item5), self.Item4), self.Item3), self.Item2), self.Item1);
	}
}
public static class Tuple7Extensions
{
	[Pure]
	public static Tuple<A, B, C, D, E, F, G> Append<SemiA, SemiB, SemiC, SemiD, SemiE, SemiF, SemiG, A, B, C, D, E, F, G>(this Tuple<A, B, C, D, E, F, G> a, Tuple<A, B, C, D, E, F, G> b) where SemiA : struct, Semigroup<A> where SemiB : struct, Semigroup<B> where SemiC : struct, Semigroup<C> where SemiD : struct, Semigroup<D> where SemiE : struct, Semigroup<E> where SemiF : struct, Semigroup<F> where SemiG : struct, Semigroup<G>
	{
		return Prelude.Tuple(default(SemiA).Append(a.Item1, b.Item1), default(SemiB).Append(a.Item2, b.Item2), default(SemiC).Append(a.Item3, b.Item3), default(SemiD).Append(a.Item4, b.Item4), default(SemiE).Append(a.Item5, b.Item5), default(SemiF).Append(a.Item6, b.Item6), default(SemiG).Append(a.Item7, b.Item7));
	}

	[Pure]
	public static A Append<SemiA, A>(this Tuple<A, A, A, A, A, A, A> a) where SemiA : struct, Semigroup<A>
	{
		return default(SemiA).Append(a.Item1, default(SemiA).Append(a.Item2, default(SemiA).Append(a.Item3, default(SemiA).Append(a.Item4, default(SemiA).Append(a.Item5, default(SemiA).Append(a.Item6, a.Item7))))));
	}

	[Pure]
	public static Tuple<A, B, C, D, E, F, G> Concat<MonoidA, MonoidB, MonoidC, MonoidD, MonoidE, MonoidF, MonoidG, A, B, C, D, E, F, G>(this Tuple<A, B, C, D, E, F, G> a, Tuple<A, B, C, D, E, F, G> b) where MonoidA : struct, Monoid<A> where MonoidB : struct, Monoid<B> where MonoidC : struct, Monoid<C> where MonoidD : struct, Monoid<D> where MonoidE : struct, Monoid<E> where MonoidF : struct, Monoid<F> where MonoidG : struct, Monoid<G>
	{
		return Prelude.Tuple(TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }), TypeClass.mconcat<MonoidB, B>(new B[2] { a.Item2, b.Item2 }), TypeClass.mconcat<MonoidC, C>(new C[2] { a.Item3, b.Item3 }), TypeClass.mconcat<MonoidD, D>(new D[2] { a.Item4, b.Item4 }), TypeClass.mconcat<MonoidE, E>(new E[2] { a.Item5, b.Item5 }), TypeClass.mconcat<MonoidF, F>(new F[2] { a.Item6, b.Item6 }), TypeClass.mconcat<MonoidG, G>(new G[2] { a.Item7, b.Item7 }));
	}

	[Pure]
	public static A Concat<MonoidA, A>(this Tuple<A, A, A, A, A, A, A> a) where MonoidA : struct, Monoid<A>
	{
		return TypeClass.mconcat<MonoidA, A>(new A[7] { a.Item1, a.Item2, a.Item3, a.Item4, a.Item5, a.Item6, a.Item7 });
	}

	[Pure]
	public static A Head<A, B, C, D, E, F, G>(this Tuple<A, B, C, D, E, F, G> self)
	{
		return self.Item1;
	}

	[Pure]
	public static G Last<A, B, C, D, E, F, G>(this Tuple<A, B, C, D, E, F, G> self)
	{
		return self.Item7;
	}

	[Pure]
	public static (B, C, D, E, F, G) Tail<A, B, C, D, E, F, G>(this Tuple<A, B, C, D, E, F, G> self)
	{
		return (self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static A Sum<NUM, A>(this Tuple<A, A, A, A, A, A, A> self) where NUM : struct, Num<A>
	{
		return TypeClass.sum<NUM, FoldTuple<A>, Tuple<A, A, A, A, A, A, A>, A>(self);
	}

	[Pure]
	public static A Product<NUM, A>(this Tuple<A, A, A, A, A, A, A> self) where NUM : struct, Num<A>
	{
		return TypeClass.product<NUM, FoldTuple<A>, Tuple<A, A, A, A, A, A, A>, A>(self);
	}

	[Pure]
	public static bool Contains<EQ, A>(this Tuple<A, A, A, A, A, A, A> self, A value) where EQ : struct, Eq<A>
	{
		if (!default(EQ).Equals(self.Item1, value) && !default(EQ).Equals(self.Item2, value) && !default(EQ).Equals(self.Item3, value) && !default(EQ).Equals(self.Item4, value) && !default(EQ).Equals(self.Item5, value) && !default(EQ).Equals(self.Item6, value))
		{
			return default(EQ).Equals(self.Item7, value);
		}
		return true;
	}

	[Pure]
	public static R Map<A, B, C, D, E, F, G, R>(this Tuple<A, B, C, D, E, F, G> self, Func<Tuple<A, B, C, D, E, F, G>, R> map)
	{
		return map(self);
	}

	[Pure]
	public static R Map<A, B, C, D, E, F, G, R>(this Tuple<A, B, C, D, E, F, G> self, Func<A, B, C, D, E, F, G, R> map)
	{
		return map(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static Tuple<T, U, V, W, X, Y, Z> Map<A, B, C, D, E, F, G, T, U, V, W, X, Y, Z>(this Tuple<A, B, C, D, E, F, G> self, Func<A, T> firstMap, Func<B, U> secondMap, Func<C, V> thirdMap, Func<D, W> fourthMap, Func<E, X> fifthMap, Func<F, Y> sixthMap, Func<G, Z> seventhMap)
	{
		return Prelude.Tuple(firstMap(self.Item1), secondMap(self.Item2), thirdMap(self.Item3), fourthMap(self.Item4), fifthMap(self.Item5), sixthMap(self.Item6), seventhMap(self.Item7));
	}

	[Pure]
	public static Tuple<R1, B, C, D, E, F, G> MapFirst<A, B, C, D, E, F, G, R1>(this Tuple<A, B, C, D, E, F, G> self, Func<A, R1> firstMap)
	{
		return Prelude.Tuple(firstMap(self.Item1), self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static Tuple<A, R2, C, D, E, F, G> MapSecond<A, B, C, D, E, F, G, R2>(this Tuple<A, B, C, D, E, F, G> self, Func<B, R2> secondMap)
	{
		return Prelude.Tuple(self.Item1, secondMap(self.Item2), self.Item3, self.Item4, self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static Tuple<A, B, R3, D, E, F, G> MapThird<A, B, C, D, E, F, G, R3>(this Tuple<A, B, C, D, E, F, G> self, Func<C, R3> thirdMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, thirdMap(self.Item3), self.Item4, self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static Tuple<A, B, C, R4, E, F, G> MapFourth<A, B, C, D, E, F, G, R4>(this Tuple<A, B, C, D, E, F, G> self, Func<D, R4> fourthMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, fourthMap(self.Item4), self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static Tuple<A, B, C, D, R5, F, G> MapFifth<A, B, C, D, E, F, G, R5>(this Tuple<A, B, C, D, E, F, G> self, Func<E, R5> fifthMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, self.Item4, fifthMap(self.Item5), self.Item6, self.Item7);
	}

	[Pure]
	public static Tuple<A, B, C, D, E, R6, G> MapSixth<A, B, C, D, E, F, G, R6>(this Tuple<A, B, C, D, E, F, G> self, Func<F, R6> sixthMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, sixthMap(self.Item6), self.Item7);
	}

	[Pure]
	public static Tuple<A, B, C, D, E, F, R7> MapSeventh<A, B, C, D, E, F, G, R7>(this Tuple<A, B, C, D, E, F, G> self, Func<G, R7> seventhMap)
	{
		return Prelude.Tuple(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, seventhMap(self.Item7));
	}

	[Pure]
	public static Tuple<U, V, W, X, Y, Z> Select<A, B, C, D, E, F, G, U, V, W, X, Y, Z>(this Tuple<A, B, C, D, E, F, G> self, Func<Tuple<A, B, C, D, E, F, G>, Tuple<U, V, W, X, Y, Z>> map)
	{
		return map(self);
	}

	public static Unit Iter<A, B, C, D, E, F, G>(this Tuple<A, B, C, D, E, F, G> self, Action<A, B, C, D, E, F, G> func)
	{
		func(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, self.Item7);
		return Unit.Default;
	}

	public static Unit Iter<A, B, C, D, E, F, G>(this Tuple<A, B, C, D, E, F, G> self, Action<A> first, Action<B> second, Action<C> third, Action<D> fourth, Action<E> fifth, Action<F> sixth, Action<G> seventh)
	{
		first(self.Item1);
		second(self.Item2);
		third(self.Item3);
		fourth(self.Item4);
		fifth(self.Item5);
		sixth(self.Item6);
		seventh(self.Item7);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<A, B, C, D, E, F, G, S>(this Tuple<A, B, C, D, E, F, G> self, S state, Func<S, A, B, C, D, E, F, G, S> fold)
	{
		return fold(state, self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static S SeptFold<A, B, C, D, E, F, G, S>(this Tuple<A, B, C, D, E, F, G> self, S state, Func<S, A, S> firstFold, Func<S, B, S> secondFold, Func<S, C, S> thirdFold, Func<S, D, S> fourthFold, Func<S, E, S> fifthFold, Func<S, F, S> sixthFold, Func<S, G, S> seventhFold)
	{
		return seventhFold(sixthFold(fifthFold(fourthFold(thirdFold(secondFold(firstFold(state, self.Item1), self.Item2), self.Item3), self.Item4), self.Item5), self.Item6), self.Item7);
	}

	[Pure]
	public static S SeptFoldBack<A, B, C, D, E, F, G, S>(this Tuple<A, B, C, D, E, F, G> self, S state, Func<S, G, S> firstFold, Func<S, F, S> secondFold, Func<S, E, S> thirdFold, Func<S, D, S> fourthFold, Func<S, C, S> fifthFold, Func<S, B, S> sixthFold, Func<S, A, S> seventhFold)
	{
		return seventhFold(sixthFold(fifthFold(fourthFold(thirdFold(secondFold(firstFold(state, self.Item7), self.Item6), self.Item5), self.Item4), self.Item3), self.Item2), self.Item1);
	}
}
public static class ValueTuple1Extensions
{
	[Pure]
	public static (A, B) Add<A, B>(this ValueTuple<A> self, B second)
	{
		return (self.Item1, second);
	}

	[Pure]
	public static ValueTuple<A> Append<SemiA, SemiB, A, B>(this ValueTuple<A> a, ValueTuple<A> b) where SemiA : struct, Semigroup<A>
	{
		return Prelude.VTuple(default(SemiA).Append(a.Item1, b.Item1));
	}

	[Pure]
	public static ValueTuple<A> Concat<MonoidA, MonoidB, A, B>(this ValueTuple<A> a, ValueTuple<A> b) where MonoidA : struct, Monoid<A> where MonoidB : struct, Monoid<B>
	{
		return Prelude.VTuple(TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }));
	}

	[Pure]
	public static A Head<A>(this ValueTuple<A> self)
	{
		return self.Item1;
	}

	[Pure]
	public static A Last<A>(this ValueTuple<A> self)
	{
		return self.Item1;
	}

	[Pure]
	public static A Sum<NUM, A>(this ValueTuple<A> self) where NUM : struct, Num<A>
	{
		return self.Item1;
	}

	[Pure]
	public static A Product<NUM, A>(this ValueTuple<A> self) where NUM : struct, Num<A>
	{
		return self.Item1;
	}

	[Pure]
	public static bool Contains<EQ, A>(this ValueTuple<A> self, A value) where EQ : struct, Eq<A>
	{
		return default(EQ).Equals(self.Item1, value);
	}

	[Pure]
	public static ValueTuple<R> Map<A, R>(this ValueTuple<A> self, Func<A, R> map)
	{
		return Prelude.VTuple(map(self.Item1));
	}

	[Pure]
	public static ValueTuple<R> Select<A, R>(this ValueTuple<A> self, Func<A, R> map)
	{
		return Prelude.VTuple(map(self.Item1));
	}

	public static Unit Iter<A>(this ValueTuple<A> self, Action<A> func)
	{
		func(self.Item1);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<A, S>(this ValueTuple<A> self, S state, Func<S, A, S> fold)
	{
		return fold(state, self.Item1);
	}
}
public static class ValueTuple2Extensions
{
	[Pure]
	public static (A, B, C) Add<A, B, C>(this (A, B) self, C third)
	{
		return (self.Item1, self.Item2, third);
	}

	[Pure]
	public static (A, B) Append<SemiA, SemiB, A, B>(this (A, B) a, (A, B) b) where SemiA : struct, Semigroup<A> where SemiB : struct, Semigroup<B>
	{
		return (default(SemiA).Append(a.Item1, b.Item1), default(SemiB).Append(a.Item2, b.Item2));
	}

	[Pure]
	public static A Append<SemiA, A>(this (A, A) a) where SemiA : struct, Semigroup<A>
	{
		return default(SemiA).Append(a.Item1, a.Item2);
	}

	[Pure]
	public static (A, B) Concat<MonoidA, MonoidB, A, B>(this (A, B) a, (A, B) b) where MonoidA : struct, Monoid<A> where MonoidB : struct, Monoid<B>
	{
		return (TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }), TypeClass.mconcat<MonoidB, B>(new B[2] { a.Item2, b.Item2 }));
	}

	[Pure]
	public static A Concat<MonoidA, A>(this (A, A) a) where MonoidA : struct, Monoid<A>
	{
		return TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, a.Item2 });
	}

	[Pure]
	public static T1 Head<T1, T2>(this (T1, T2) self)
	{
		return self.Item1;
	}

	[Pure]
	public static T2 Last<T1, T2>(this (T1, T2) self)
	{
		return self.Item2;
	}

	[Pure]
	public static ValueTuple<T2> Tail<T1, T2>(this (T1, T2) self)
	{
		return Prelude.VTuple(self.Item2);
	}

	[Pure]
	public static A Sum<NUM, A>(this (A, A) self) where NUM : struct, Num<A>
	{
		return TypeClass.sum<NUM, FoldTuple<A>, (A, A), A>(self);
	}

	[Pure]
	public static A Product<NUM, A>(this (A, A) self) where NUM : struct, Num<A>
	{
		return TypeClass.product<NUM, FoldTuple<A>, (A, A), A>(self);
	}

	[Pure]
	public static bool Contains<EQ, A>(this (A, A) self, A value) where EQ : struct, Eq<A>
	{
		return TypeClass.contains<EQ, FoldTuple<A>, (A, A), A>(self, value);
	}

	[Pure]
	public static R Map<A, B, R>(this (A, B) self, Func<(A, B), R> map)
	{
		return map(self);
	}

	[Pure]
	public static R Map<A, B, R>(this (A, B) self, Func<A, B, R> map)
	{
		return map(self.Item1, self.Item2);
	}

	[Pure]
	public static (R1, R2) BiMap<T1, T2, R1, R2>(this (T1, T2) self, Func<T1, R1> firstMap, Func<T2, R2> secondMap)
	{
		return (firstMap(self.Item1), secondMap(self.Item2));
	}

	[Pure]
	public static (R1, T2) MapFirst<T1, T2, R1>(this (T1, T2) self, Func<T1, R1> firstMap)
	{
		return (firstMap(self.Item1), self.Item2);
	}

	[Pure]
	public static (T1, R2) MapSecond<T1, T2, R2>(this (T1, T2) self, Func<T2, R2> secondMap)
	{
		return (self.Item1, secondMap(self.Item2));
	}

	[Pure]
	public static (R1, R2) Select<T1, T2, R1, R2>(this (T1, T2) self, Func<(T1, T2), (R1, R2)> map)
	{
		return map(self);
	}

	public static Unit Iter<T1, T2>(this (T1, T2) self, Action<T1, T2> func)
	{
		func(self.Item1, self.Item2);
		return Unit.Default;
	}

	public static Unit Iter<T1, T2>(this (T1, T2) self, Action<T1> first, Action<T2> second)
	{
		first(self.Item1);
		second(self.Item2);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<T1, T2, S>(this (T1, T2) self, S state, Func<S, T1, T2, S> fold)
	{
		return fold(state, self.Item1, self.Item2);
	}

	[Pure]
	public static S BiFold<T1, T2, S>(this (T1, T2) self, S state, Func<S, T1, S> firstFold, Func<S, T2, S> secondFold)
	{
		return secondFold(firstFold(state, self.Item1), self.Item2);
	}

	[Pure]
	public static S BiFoldBack<T1, T2, S>(this (T1, T2) self, S state, Func<S, T2, S> firstFold, Func<S, T1, S> secondFold)
	{
		return secondFold(firstFold(state, self.Item2), self.Item1);
	}

	[Pure]
	public static Arr<(C, D)> Traverse<A, B, C, D>(this (Arr<A> ma, Arr<B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		return ArrExtensions.Select(from a in tuple.ma
			from b in tuple.mb
			select new
			{
				<>h__TransparentIdentifier0 = <>h__TransparentIdentifier0,
				r = f((a, b))
			}, <>h__TransparentIdentifier1 => (<>h__TransparentIdentifier1.r.c, <>h__TransparentIdentifier1.r.d));
	}

	[Pure]
	public static Arr<(C, D)> Traverse<A, B, C, D>(this (Arr<A> ma, Arr<B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		return ArrExtensions.Select(from a in tuple.ma
			from b in tuple.mb
			select new
			{
				<>h__TransparentIdentifier0 = <>h__TransparentIdentifier0,
				r = f(a, b)
			}, <>h__TransparentIdentifier1 => (<>h__TransparentIdentifier1.r.c, <>h__TransparentIdentifier1.r.d));
	}

	[Pure]
	public static Arr<(A, B)> Sequence<A, B>(this (Arr<A> ma, Arr<B> mb) tuple)
	{
		return from a in tuple.ma
			from b in tuple.mb
			select (a, b);
	}

	[Pure]
	public static Either<L, (C, D)> Traverse<L, A, B, C, D>(this (Either<L, A> ma, Either<L, B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		Either<L, A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			let r = f((a, b))
			select (r.c, r.d);
	}

	[Pure]
	public static Either<L, (C, D)> Traverse<L, A, B, C, D>(this (Either<L, A> ma, Either<L, B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		Either<L, A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			let r = f(a, b)
			select (r.c, r.d);
	}

	[Pure]
	public static Either<L, (A, B)> Sequence<L, A, B>(this (Either<L, A> ma, Either<L, B> mb) tuple)
	{
		Either<L, A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			select (a, b);
	}

	[Pure]
	public static EitherUnsafe<L, (C, D)> Traverse<L, A, B, C, D>(this (EitherUnsafe<L, A> ma, EitherUnsafe<L, B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		EitherUnsafe<L, A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			let r = f((a, b))
			select (r.c, r.d);
	}

	[Pure]
	public static EitherUnsafe<L, (C, D)> Traverse<L, A, B, C, D>(this (EitherUnsafe<L, A> ma, EitherUnsafe<L, B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		EitherUnsafe<L, A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			let r = f(a, b)
			select (r.c, r.d);
	}

	[Pure]
	public static EitherUnsafe<L, (A, B)> Sequence<L, A, B>(this (EitherUnsafe<L, A> ma, EitherUnsafe<L, B> mb) tuple)
	{
		EitherUnsafe<L, A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			select (a, b);
	}

	[Pure]
	public static EitherAsync<L, (C, D)> Traverse<L, A, B, C, D>(this (EitherAsync<L, A> ma, EitherAsync<L, B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		return Prelude.apply((A a, B b) => f((a, b)), tuple.ma, tuple.mb);
	}

	[Pure]
	public static EitherAsync<L, (C, D)> Traverse<L, A, B, C, D>(this (EitherAsync<L, A> ma, EitherAsync<L, B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		return Prelude.apply((A a, B b) => f(a, b), tuple.ma, tuple.mb);
	}

	[Pure]
	public static EitherAsync<L, (A, B)> Sequence<L, A, B>(this (EitherAsync<L, A> ma, EitherAsync<L, B> mb) tuple)
	{
		return Prelude.apply((A a, B b) => (a, b), tuple.ma, tuple.mb);
	}

	[Pure]
	public static LanguageExt.HashSet<(C, D)> Traverse<A, B, C, D>(this (LanguageExt.HashSet<A> ma, LanguageExt.HashSet<B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		LanguageExt.HashSet<A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			let r = f((a, b))
			select (r.c, r.d);
	}

	[Pure]
	public static LanguageExt.HashSet<(C, D)> Traverse<A, B, C, D>(this (LanguageExt.HashSet<A> ma, LanguageExt.HashSet<B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		LanguageExt.HashSet<A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			let r = f(a, b)
			select (r.c, r.d);
	}

	[Pure]
	public static LanguageExt.HashSet<(A, B)> Sequence<A, B>(this (LanguageExt.HashSet<A> ma, LanguageExt.HashSet<B> mb) tuple)
	{
		LanguageExt.HashSet<A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			select (a, b);
	}

	[Pure]
	public static Lst<(C, D)> Traverse<A, B, C, D>(this (Lst<A> ma, Lst<B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		return ListExtensions.Select(from a in tuple.ma
			from b in tuple.mb
			select new
			{
				<>h__TransparentIdentifier0 = <>h__TransparentIdentifier0,
				r = f((a, b))
			}, <>h__TransparentIdentifier1 => (<>h__TransparentIdentifier1.r.c, <>h__TransparentIdentifier1.r.d));
	}

	[Pure]
	public static Lst<(C, D)> Traverse<A, B, C, D>(this (Lst<A> ma, Lst<B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		return ListExtensions.Select(from a in tuple.ma
			from b in tuple.mb
			select new
			{
				<>h__TransparentIdentifier0 = <>h__TransparentIdentifier0,
				r = f(a, b)
			}, <>h__TransparentIdentifier1 => (<>h__TransparentIdentifier1.r.c, <>h__TransparentIdentifier1.r.d));
	}

	[Pure]
	public static Lst<(A, B)> Sequence<A, B>(this (Lst<A> ma, Lst<B> mb) tuple)
	{
		return from a in tuple.ma
			from b in tuple.mb
			select (a, b);
	}

	[Pure]
	public static Option<(C, D)> Traverse<A, B, C, D>(this (Option<A> ma, Option<B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		Option<A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			let r = f((a, b))
			select (r.c, r.d);
	}

	[Pure]
	public static Option<(C, D)> Traverse<A, B, C, D>(this (Option<A> ma, Option<B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		Option<A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			let r = f(a, b)
			select (r.c, r.d);
	}

	[Pure]
	public static Option<(A, B)> Sequence<A, B>(this (Option<A> ma, Option<B> mb) tuple)
	{
		Option<A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			select (a, b);
	}

	[Pure]
	public static OptionUnsafe<(C, D)> Traverse<A, B, C, D>(this (OptionUnsafe<A> ma, OptionUnsafe<B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		OptionUnsafe<A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			let r = f((a, b))
			select (r.c, r.d);
	}

	[Pure]
	public static OptionUnsafe<(C, D)> Traverse<A, B, C, D>(this (OptionUnsafe<A> ma, OptionUnsafe<B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		OptionUnsafe<A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			let r = f(a, b)
			select (r.c, r.d);
	}

	[Pure]
	public static OptionUnsafe<(A, B)> Sequence<A, B>(this (OptionUnsafe<A> ma, OptionUnsafe<B> mb) tuple)
	{
		OptionUnsafe<A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			select (a, b);
	}

	[Pure]
	public static OptionAsync<(C, D)> Traverse<A, B, C, D>(this (OptionAsync<A> ma, OptionAsync<B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		return Prelude.apply((A a, B b) => f((a, b)), tuple.ma, tuple.mb);
	}

	[Pure]
	public static OptionAsync<(C, D)> Traverse<A, B, C, D>(this (OptionAsync<A> ma, OptionAsync<B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		return Prelude.apply((A a, B b) => f(a, b), tuple.ma, tuple.mb);
	}

	[Pure]
	public static OptionAsync<(A, B)> Sequence<A, B>(this (OptionAsync<A> ma, OptionAsync<B> mb) tuple)
	{
		return Prelude.apply((A a, B b) => (a, b), tuple.ma, tuple.mb);
	}

	[Pure]
	public static Reader<Env, (C, D)> Traverse<Env, A, B, C, D>(this (Reader<Env, A> ma, Reader<Env, B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		return from a in tuple.ma
			from b in tuple.mb
			let r = f((a, b))
			select (r.c, r.d);
	}

	[Pure]
	public static Reader<Env, (C, D)> Traverse<Env, A, B, C, D>(this (Reader<Env, A> ma, Reader<Env, B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		return from a in tuple.ma
			from b in tuple.mb
			let r = f(a, b)
			select (r.c, r.d);
	}

	[Pure]
	public static Reader<Env, (A, B)> Sequence<Env, A, B>(this (Reader<Env, A> ma, Reader<Env, B> mb) tuple)
	{
		return from a in tuple.ma
			from b in tuple.mb
			select (a, b);
	}

	[Pure]
	public static Set<(C, D)> Traverse<A, B, C, D>(this (Set<A> ma, Set<B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		Set<A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			let r = f((a, b))
			select (r.c, r.d);
	}

	[Pure]
	public static Set<(C, D)> Traverse<A, B, C, D>(this (Set<A> ma, Set<B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		Set<A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			let r = f(a, b)
			select (r.c, r.d);
	}

	[Pure]
	public static Set<(A, B)> Sequence<A, B>(this (Set<A> ma, Set<B> mb) tuple)
	{
		Set<A> item = tuple.ma;
		return from a in item
			from b in tuple.mb
			select (a, b);
	}

	[Pure]
	public static State<S, (C, D)> Traverse<S, A, B, C, D>(this (State<S, A> ma, State<S, B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		return from a in tuple.ma
			from b in tuple.mb
			let r = f((a, b))
			select (r.c, r.d);
	}

	[Pure]
	public static State<S, (C, D)> Traverse<S, A, B, C, D>(this (State<S, A> ma, State<S, B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		return from a in tuple.ma
			from b in tuple.mb
			let r = f(a, b)
			select (r.c, r.d);
	}

	[Pure]
	public static State<S, (A, B)> Sequence<S, A, B>(this (State<S, A> ma, State<S, B> mb) tuple)
	{
		return from a in tuple.ma
			from b in tuple.mb
			select (a, b);
	}

	[Pure]
	public static Task<(C, D)> Traverse<A, B, C, D>(this (Task<A> ma, Task<B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		return Prelude.apply((A a, B b) => f((a, b)), tuple.ma, tuple.mb);
	}

	[Pure]
	public static Task<(C, D)> Traverse<A, B, C, D>(this (Task<A> ma, Task<B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		return Prelude.apply((A a, B b) => f(a, b), tuple.ma, tuple.mb);
	}

	[Pure]
	public static Task<(A, B)> Sequence<A, B>(this (Task<A> ma, Task<B> mb) tuple)
	{
		return Prelude.apply((A a, B b) => (a, b), tuple.ma, tuple.mb);
	}

	[Pure]
	public static Try<(C, D)> Traverse<A, B, C, D>(this (Try<A> ma, Try<B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		return from a in tuple.ma
			from b in tuple.mb
			let r = f((a, b))
			select (r.c, r.d);
	}

	[Pure]
	public static Try<(C, D)> Traverse<A, B, C, D>(this (Try<A> ma, Try<B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		return from a in tuple.ma
			from b in tuple.mb
			let r = f(a, b)
			select (r.c, r.d);
	}

	[Pure]
	public static Try<(A, B)> Sequence<A, B>(this (Try<A> ma, Try<B> mb) tuple)
	{
		return from a in tuple.ma
			from b in tuple.mb
			select (a, b);
	}

	[Pure]
	public static TryAsync<(C, D)> Traverse<A, B, C, D>(this (TryAsync<A> ma, TryAsync<B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		return Prelude.apply((A a, B b) => f((a, b)), tuple.ma, tuple.mb);
	}

	[Pure]
	public static TryAsync<(C, D)> Traverse<A, B, C, D>(this (TryAsync<A> ma, TryAsync<B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		return Prelude.apply((A a, B b) => f(a, b), tuple.ma, tuple.mb);
	}

	[Pure]
	public static TryAsync<(A, B)> Sequence<A, B>(this (TryAsync<A> ma, TryAsync<B> mb) tuple)
	{
		return Prelude.apply((A a, B b) => (a, b), tuple.ma, tuple.mb);
	}

	[Pure]
	public static TryOption<(C, D)> Traverse<A, B, C, D>(this (TryOption<A> ma, TryOption<B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		return from a in tuple.ma
			from b in tuple.mb
			let r = f((a, b))
			select (r.c, r.d);
	}

	[Pure]
	public static TryOption<(C, D)> Traverse<A, B, C, D>(this (TryOption<A> ma, TryOption<B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		return from a in tuple.ma
			from b in tuple.mb
			let r = f(a, b)
			select (r.c, r.d);
	}

	[Pure]
	public static TryOption<(A, B)> Sequence<A, B>(this (TryOption<A> ma, TryOption<B> mb) tuple)
	{
		return from a in tuple.ma
			from b in tuple.mb
			select (a, b);
	}

	[Pure]
	public static TryOptionAsync<(C, D)> Traverse<A, B, C, D>(this (TryOptionAsync<A> ma, TryOptionAsync<B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		return Prelude.apply((A a, B b) => f((a, b)), tuple.ma, tuple.mb);
	}

	[Pure]
	public static TryOptionAsync<(C, D)> Traverse<A, B, C, D>(this (TryOptionAsync<A> ma, TryOptionAsync<B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		return Prelude.apply((A a, B b) => f(a, b), tuple.ma, tuple.mb);
	}

	[Pure]
	public static TryOptionAsync<(A, B)> Sequence<A, B>(this (TryOptionAsync<A> ma, TryOptionAsync<B> mb) tuple)
	{
		return Prelude.apply((A a, B b) => (a, b), tuple.ma, tuple.mb);
	}

	[Pure]
	public static Validation<MonoidFail, L, (C, D)> Traverse<MonoidFail, L, A, B, C, D>(this (Validation<MonoidFail, L, A> ma, Validation<MonoidFail, L, B> mb) tuple, Func<(A a, B b), (C c, D d)> f) where MonoidFail : struct, Monoid<L>, Eq<L>
	{
		return tuple.Apply((A a, B b) => f((a, b)));
	}

	[Pure]
	public static Validation<MonoidFail, L, (C, D)> Traverse<MonoidFail, L, A, B, C, D>(this (Validation<MonoidFail, L, A> ma, Validation<MonoidFail, L, B> mb) tuple, Func<A, B, (C c, D d)> f) where MonoidFail : struct, Monoid<L>, Eq<L>
	{
		return tuple.Apply(f);
	}

	[Pure]
	public static Validation<MonoidFail, L, (A, B)> Sequence<MonoidFail, L, A, B>(this (Validation<MonoidFail, L, A> ma, Validation<MonoidFail, L, B> mb) tuple) where MonoidFail : struct, Monoid<L>, Eq<L>
	{
		return tuple.Apply((A a, B b) => (a, b));
	}

	[Pure]
	public static Validation<L, (C, D)> Traverse<L, A, B, C, D>(this (Validation<L, A> ma, Validation<L, B> mb) tuple, Func<(A a, B b), (C c, D d)> f)
	{
		return tuple.Apply((A a, B b) => f((a, b)));
	}

	[Pure]
	public static Validation<L, (C, D)> Traverse<L, A, B, C, D>(this (Validation<L, A> ma, Validation<L, B> mb) tuple, Func<A, B, (C c, D d)> f)
	{
		return tuple.Apply(f);
	}

	[Pure]
	public static Validation<L, (A, B)> Sequence<L, A, B>(this (Validation<L, A> ma, Validation<L, B> mb) tuple)
	{
		return tuple.Apply((A a, B b) => (a, b));
	}
}
public static class ValueTuple3Extensions
{
	[Pure]
	public static (T1, T2, T3, T4) Add<T1, T2, T3, T4>(this (T1, T2, T3) self, T4 fourth)
	{
		return (self.Item1, self.Item2, self.Item3, fourth);
	}

	[Pure]
	public static (A, B, C) Append<SemiA, SemiB, SemiC, A, B, C>(this (A, B, C) a, (A, B, C) b) where SemiA : struct, Semigroup<A> where SemiB : struct, Semigroup<B> where SemiC : struct, Semigroup<C>
	{
		return (default(SemiA).Append(a.Item1, b.Item1), default(SemiB).Append(a.Item2, b.Item2), default(SemiC).Append(a.Item3, b.Item3));
	}

	[Pure]
	public static A Append<SemiA, A>(this (A, A, A) a) where SemiA : struct, Semigroup<A>
	{
		return default(SemiA).Append(a.Item1, default(SemiA).Append(a.Item2, a.Item3));
	}

	[Pure]
	public static (A, B, C) Concat<MonoidA, MonoidB, MonoidC, A, B, C>(this (A, B, C) a, (A, B, C) b) where MonoidA : struct, Monoid<A> where MonoidB : struct, Monoid<B> where MonoidC : struct, Monoid<C>
	{
		return (TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }), TypeClass.mconcat<MonoidB, B>(new B[2] { a.Item2, b.Item2 }), TypeClass.mconcat<MonoidC, C>(new C[2] { a.Item3, b.Item3 }));
	}

	[Pure]
	public static A Concat<MonoidA, A>(this (A, A, A) a) where MonoidA : struct, Monoid<A>
	{
		return TypeClass.mconcat<MonoidA, A>(new A[3] { a.Item1, a.Item2, a.Item3 });
	}

	[Pure]
	public static T1 Head<T1, T2, T3>(this (T1, T2, T3) self)
	{
		return self.Item1;
	}

	[Pure]
	public static T3 Last<T1, T2, T3>(this (T1, T2, T3) self)
	{
		return self.Item3;
	}

	[Pure]
	public static (T2, T3) Tail<T1, T2, T3>(this (T1, T2, T3) self)
	{
		return (self.Item2, self.Item3);
	}

	[Pure]
	public static A Sum<NUM, A>(this (A, A, A) self) where NUM : struct, Num<A>
	{
		return default(NUM).Plus(self.Item1, default(NUM).Plus(self.Item2, self.Item3));
	}

	[Pure]
	public static A Product<NUM, A>(this (A, A, A) self) where NUM : struct, Num<A>
	{
		return default(NUM).Product(self.Item1, default(NUM).Product(self.Item2, self.Item3));
	}

	[Pure]
	public static bool Contains<EQ, A>(this (A, A, A) self, A value) where EQ : struct, Eq<A>
	{
		if (!default(EQ).Equals(self.Item1, value) && !default(EQ).Equals(self.Item2, value))
		{
			return default(EQ).Equals(self.Item3, value);
		}
		return true;
	}

	[Pure]
	public static R Map<A, B, C, R>(this (A, B, C) self, Func<(A, B, C), R> map)
	{
		return map(self);
	}

	[Pure]
	public static R Map<A, B, C, R>(this (A, B, C) self, Func<A, B, C, R> map)
	{
		return map(self.Item1, self.Item2, self.Item3);
	}

	[Pure]
	public static (R1, R2, R3) Map<T1, T2, T3, R1, R2, R3>(this (T1, T2, T3) self, Func<T1, R1> firstMap, Func<T2, R2> secondMap, Func<T3, R3> thirdMap)
	{
		return (firstMap(self.Item1), secondMap(self.Item2), thirdMap(self.Item3));
	}

	[Pure]
	public static (R1, T2, T3) MapFirst<T1, T2, T3, R1>(this (T1, T2, T3) self, Func<T1, R1> firstMap)
	{
		return (firstMap(self.Item1), self.Item2, self.Item3);
	}

	[Pure]
	public static (T1, R2, T3) MapSecond<T1, T2, T3, R2>(this (T1, T2, T3) self, Func<T2, R2> secondMap)
	{
		return (self.Item1, secondMap(self.Item2), self.Item3);
	}

	[Pure]
	public static (T1, T2, R3) MapThird<T1, T2, T3, R3>(this (T1, T2, T3) self, Func<T3, R3> thirdMap)
	{
		return (self.Item1, self.Item2, thirdMap(self.Item3));
	}

	[Pure]
	public static (R1, R2, R3) Select<T1, T2, T3, R1, R2, R3>(this (T1, T2, T3) self, Func<(T1, T2, T3), (R1, R2, R3)> map)
	{
		return map(self);
	}

	public static Unit Iter<T1, T2, T3>(this (T1, T2, T3) self, Action<T1, T2, T3> func)
	{
		func(self.Item1, self.Item2, self.Item3);
		return Unit.Default;
	}

	public static Unit Iter<T1, T2, T3>(this (T1, T2, T3) self, Action<T1> first, Action<T2> second, Action<T3> third)
	{
		first(self.Item1);
		second(self.Item2);
		third(self.Item3);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<T1, T2, T3, S>(this (T1, T2, T3) self, S state, Func<S, T1, T2, T3, S> fold)
	{
		return fold(state, self.Item1, self.Item2, self.Item3);
	}

	[Pure]
	public static S TriFold<T1, T2, T3, S>(this (T1, T2, T3) self, S state, Func<S, T1, S> firstFold, Func<S, T2, S> secondFold, Func<S, T3, S> thirdFold)
	{
		return thirdFold(secondFold(firstFold(state, self.Item1), self.Item2), self.Item3);
	}

	[Pure]
	public static S TriFoldBack<T1, T2, T3, S>(this (T1, T2, T3) self, S state, Func<S, T3, S> firstFold, Func<S, T2, S> secondFold, Func<S, T1, S> thirdFold)
	{
		return thirdFold(secondFold(firstFold(state, self.Item3), self.Item2), self.Item1);
	}
}
public static class ValueTuple4Extensions
{
	[Pure]
	public static (A, B, C, D, E) Add<A, B, C, D, E>(this (A, B, C, D) self, E fifth)
	{
		return (self.Item1, self.Item2, self.Item3, self.Item4, fifth);
	}

	[Pure]
	public static (A, B, C, D) Append<SemiA, SemiB, SemiC, SemiD, A, B, C, D>(this (A, B, C, D) a, (A, B, C, D) b) where SemiA : struct, Semigroup<A> where SemiB : struct, Semigroup<B> where SemiC : struct, Semigroup<C> where SemiD : struct, Semigroup<D>
	{
		return (default(SemiA).Append(a.Item1, b.Item1), default(SemiB).Append(a.Item2, b.Item2), default(SemiC).Append(a.Item3, b.Item3), default(SemiD).Append(a.Item4, b.Item4));
	}

	[Pure]
	public static A Append<SemiA, A>(this (A, A, A, A) a) where SemiA : struct, Semigroup<A>
	{
		return default(SemiA).Append(a.Item1, default(SemiA).Append(a.Item2, default(SemiA).Append(a.Item3, a.Item4)));
	}

	[Pure]
	public static (A, B, C, D) Concat<MonoidA, MonoidB, MonoidC, MonoidD, A, B, C, D>(this (A, B, C, D) a, (A, B, C, D) b) where MonoidA : struct, Monoid<A> where MonoidB : struct, Monoid<B> where MonoidC : struct, Monoid<C> where MonoidD : struct, Monoid<D>
	{
		return (TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }), TypeClass.mconcat<MonoidB, B>(new B[2] { a.Item2, b.Item2 }), TypeClass.mconcat<MonoidC, C>(new C[2] { a.Item3, b.Item3 }), TypeClass.mconcat<MonoidD, D>(new D[2] { a.Item4, b.Item4 }));
	}

	[Pure]
	public static A Concat<MonoidA, A>(this (A, A, A, A) a) where MonoidA : struct, Monoid<A>
	{
		return TypeClass.mconcat<MonoidA, A>(new A[4] { a.Item1, a.Item2, a.Item3, a.Item4 });
	}

	[Pure]
	public static A Head<A, B, C, D>(this (A, B, C, D) self)
	{
		return self.Item1;
	}

	[Pure]
	public static D Last<A, B, C, D>(this (A, B, C, D) self)
	{
		return self.Item4;
	}

	[Pure]
	public static (B, C, D) Tail<A, B, C, D>(this (A, B, C, D) self)
	{
		return (self.Item2, self.Item3, self.Item4);
	}

	[Pure]
	public static A Sum<NUM, A>(this (A, A, A, A) self) where NUM : struct, Num<A>
	{
		return TypeClass.sum<NUM, FoldTuple<A>, (A, A, A, A), A>(self);
	}

	[Pure]
	public static A Product<NUM, A>(this (A, A, A, A) self) where NUM : struct, Num<A>
	{
		return TypeClass.product<NUM, FoldTuple<A>, (A, A, A, A), A>(self);
	}

	[Pure]
	public static bool Contains<EQ, A>(this (A, A, A, A) self, A value) where EQ : struct, Eq<A>
	{
		if (!default(EQ).Equals(self.Item1, value) && !default(EQ).Equals(self.Item2, value) && !default(EQ).Equals(self.Item3, value))
		{
			return default(EQ).Equals(self.Item4, value);
		}
		return true;
	}

	[Pure]
	public static R Map<A, B, C, D, R>(this (A, B, C, D) self, Func<(A, B, C, D), R> map)
	{
		return map(self);
	}

	[Pure]
	public static R Map<A, B, C, D, R>(this (A, B, C, D) self, Func<A, B, C, D, R> map)
	{
		return map(self.Item1, self.Item2, self.Item3, self.Item4);
	}

	[Pure]
	public static (W, X, Y, Z) Map<A, B, C, D, W, X, Y, Z>(this (A, B, C, D) self, Func<A, W> firstMap, Func<B, X> secondMap, Func<C, Y> thirdMap, Func<D, Z> fourthMap)
	{
		return (firstMap(self.Item1), secondMap(self.Item2), thirdMap(self.Item3), fourthMap(self.Item4));
	}

	[Pure]
	public static (R1, B, C, D) MapFirst<A, B, C, D, R1>(this (A, B, C, D) self, Func<A, R1> firstMap)
	{
		return (firstMap(self.Item1), self.Item2, self.Item3, self.Item4);
	}

	[Pure]
	public static (A, R2, C, D) MapSecond<A, B, C, D, R2>(this (A, B, C, D) self, Func<B, R2> secondMap)
	{
		return (self.Item1, secondMap(self.Item2), self.Item3, self.Item4);
	}

	[Pure]
	public static (A, B, R3, D) MapThird<A, B, C, D, R3>(this (A, B, C, D) self, Func<C, R3> thirdMap)
	{
		return (self.Item1, self.Item2, thirdMap(self.Item3), self.Item4);
	}

	[Pure]
	public static (A, B, C, R4) MapFourth<A, B, C, D, R4>(this (A, B, C, D) self, Func<D, R4> fourthMap)
	{
		return (self.Item1, self.Item2, self.Item3, fourthMap(self.Item4));
	}

	[Pure]
	public static (W, X, Y, Z) Select<A, B, C, D, W, X, Y, Z>(this (A, B, C, D) self, Func<(A, B, C, D), (W, X, Y, Z)> map)
	{
		return map(self);
	}

	public static Unit Iter<A, B, C, D>(this (A, B, C, D) self, Action<A, B, C, D> func)
	{
		func(self.Item1, self.Item2, self.Item3, self.Item4);
		return Unit.Default;
	}

	public static Unit Iter<A, B, C, D>(this (A, B, C, D) self, Action<A> first, Action<B> second, Action<C> third, Action<D> fourth)
	{
		first(self.Item1);
		second(self.Item2);
		third(self.Item3);
		fourth(self.Item4);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<A, B, C, D, S>(this (A, B, C, D) self, S state, Func<S, A, B, C, D, S> fold)
	{
		return fold(state, self.Item1, self.Item2, self.Item3, self.Item4);
	}

	[Pure]
	public static S QuadFold<A, B, C, D, S>(this (A, B, C, D) self, S state, Func<S, A, S> firstFold, Func<S, B, S> secondFold, Func<S, C, S> thirdFold, Func<S, D, S> fourthFold)
	{
		return fourthFold(thirdFold(secondFold(firstFold(state, self.Item1), self.Item2), self.Item3), self.Item4);
	}

	[Pure]
	public static S QuadFoldBack<A, B, C, D, S>(this (A, B, C, D) self, S state, Func<S, D, S> firstFold, Func<S, C, S> secondFold, Func<S, B, S> thirdFold, Func<S, A, S> fourthFold)
	{
		return fourthFold(thirdFold(secondFold(firstFold(state, self.Item4), self.Item3), self.Item2), self.Item1);
	}
}
public static class ValueTuple5Extensions
{
	[Pure]
	public static (A, B, C, D, E, F) Add<A, B, C, D, E, F>(this (A, B, C, D, E) self, F sixth)
	{
		return (self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, sixth);
	}

	[Pure]
	public static (A, B, C, D, E) Append<SemiA, SemiB, SemiC, SemiD, SemiE, A, B, C, D, E>(this (A, B, C, D, E) a, (A, B, C, D, E) b) where SemiA : struct, Semigroup<A> where SemiB : struct, Semigroup<B> where SemiC : struct, Semigroup<C> where SemiD : struct, Semigroup<D> where SemiE : struct, Semigroup<E>
	{
		return (default(SemiA).Append(a.Item1, b.Item1), default(SemiB).Append(a.Item2, b.Item2), default(SemiC).Append(a.Item3, b.Item3), default(SemiD).Append(a.Item4, b.Item4), default(SemiE).Append(a.Item5, b.Item5));
	}

	[Pure]
	public static A Append<SemiA, A>(this (A, A, A, A, A) a) where SemiA : struct, Semigroup<A>
	{
		return default(SemiA).Append(a.Item1, default(SemiA).Append(a.Item2, default(SemiA).Append(a.Item3, default(SemiA).Append(a.Item4, a.Item5))));
	}

	[Pure]
	public static (A, B, C, D, E) Concat<MonoidA, MonoidB, MonoidC, MonoidD, MonoidE, A, B, C, D, E>(this (A, B, C, D, E) a, (A, B, C, D, E) b) where MonoidA : struct, Monoid<A> where MonoidB : struct, Monoid<B> where MonoidC : struct, Monoid<C> where MonoidD : struct, Monoid<D> where MonoidE : struct, Monoid<E>
	{
		return (TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }), TypeClass.mconcat<MonoidB, B>(new B[2] { a.Item2, b.Item2 }), TypeClass.mconcat<MonoidC, C>(new C[2] { a.Item3, b.Item3 }), TypeClass.mconcat<MonoidD, D>(new D[2] { a.Item4, b.Item4 }), TypeClass.mconcat<MonoidE, E>(new E[2] { a.Item5, b.Item5 }));
	}

	[Pure]
	public static A Concat<MonoidA, A>(this (A, A, A, A, A) a) where MonoidA : struct, Monoid<A>
	{
		return TypeClass.mconcat<MonoidA, A>(new A[5] { a.Item1, a.Item2, a.Item3, a.Item4, a.Item5 });
	}

	[Pure]
	public static A Head<A, B, C, D, E>(this (A, B, C, D, E) self)
	{
		return self.Item1;
	}

	[Pure]
	public static E Last<A, B, C, D, E>(this (A, B, C, D, E) self)
	{
		return self.Item5;
	}

	[Pure]
	public static (B, C, D, E) Tail<A, B, C, D, E>(this (A, B, C, D, E) self)
	{
		return (self.Item2, self.Item3, self.Item4, self.Item5);
	}

	[Pure]
	public static A Sum<NUM, A>(this (A, A, A, A, A) self) where NUM : struct, Num<A>
	{
		return TypeClass.sum<NUM, FoldTuple<A>, (A, A, A, A, A), A>(self);
	}

	[Pure]
	public static A Product<NUM, A>(this (A, A, A, A, A) self) where NUM : struct, Num<A>
	{
		return TypeClass.product<NUM, FoldTuple<A>, (A, A, A, A, A), A>(self);
	}

	[Pure]
	public static bool Contains<EQ, A>(this (A, A, A, A, A) self, A value) where EQ : struct, Eq<A>
	{
		if (!default(EQ).Equals(self.Item1, value) && !default(EQ).Equals(self.Item2, value) && !default(EQ).Equals(self.Item3, value) && !default(EQ).Equals(self.Item4, value))
		{
			return default(EQ).Equals(self.Item5, value);
		}
		return true;
	}

	[Pure]
	public static R Map<A, B, C, D, E, R>(this (A, B, C, D, E) self, Func<(A, B, C, D, E), R> map)
	{
		return map(self);
	}

	[Pure]
	public static R Map<A, B, C, D, E, R>(this (A, B, C, D, E) self, Func<A, B, C, D, E, R> map)
	{
		return map(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5);
	}

	[Pure]
	public static (V, W, X, Y, Z) Map<A, B, C, D, E, V, W, X, Y, Z>(this (A, B, C, D, E) self, Func<A, V> firstMap, Func<B, W> secondMap, Func<C, X> thirdMap, Func<D, Y> fourthMap, Func<E, Z> fifthMap)
	{
		return (firstMap(self.Item1), secondMap(self.Item2), thirdMap(self.Item3), fourthMap(self.Item4), fifthMap(self.Item5));
	}

	[Pure]
	public static (R1, B, C, D, E) MapFirst<A, B, C, D, E, R1>(this (A, B, C, D, E) self, Func<A, R1> firstMap)
	{
		return (firstMap(self.Item1), self.Item2, self.Item3, self.Item4, self.Item5);
	}

	[Pure]
	public static (A, R2, C, D, E) MapSecond<A, B, C, D, E, R2>(this (A, B, C, D, E) self, Func<B, R2> secondMap)
	{
		return (self.Item1, secondMap(self.Item2), self.Item3, self.Item4, self.Item5);
	}

	[Pure]
	public static (A, B, R3, D, E) MapThird<A, B, C, D, E, R3>(this (A, B, C, D, E) self, Func<C, R3> thirdMap)
	{
		return (self.Item1, self.Item2, thirdMap(self.Item3), self.Item4, self.Item5);
	}

	[Pure]
	public static (A, B, C, R4, E) MapFourth<A, B, C, D, E, R4>(this (A, B, C, D, E) self, Func<D, R4> fourthMap)
	{
		return (self.Item1, self.Item2, self.Item3, fourthMap(self.Item4), self.Item5);
	}

	[Pure]
	public static (A, B, C, D, R5) MapFifth<A, B, C, D, E, R5>(this (A, B, C, D, E) self, Func<E, R5> fifthMap)
	{
		return (self.Item1, self.Item2, self.Item3, self.Item4, fifthMap(self.Item5));
	}

	[Pure]
	public static (V, W, X, Y, Z) Select<A, B, C, D, E, V, W, X, Y, Z>(this (A, B, C, D, E) self, Func<(A, B, C, D, E), (V, W, X, Y, Z)> map)
	{
		return map(self);
	}

	public static Unit Iter<A, B, C, D, E>(this (A, B, C, D, E) self, Action<A, B, C, D, E> func)
	{
		func(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5);
		return Unit.Default;
	}

	public static Unit Iter<A, B, C, D, E>(this (A, B, C, D, E) self, Action<A> first, Action<B> second, Action<C> third, Action<D> fourth, Action<E> fifth)
	{
		first(self.Item1);
		second(self.Item2);
		third(self.Item3);
		fourth(self.Item4);
		fifth(self.Item5);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<A, B, C, D, E, S>(this (A, B, C, D, E) self, S state, Func<S, A, B, C, D, E, S> fold)
	{
		return fold(state, self.Item1, self.Item2, self.Item3, self.Item4, self.Item5);
	}

	[Pure]
	public static S QuintFold<A, B, C, D, E, S>(this (A, B, C, D, E) self, S state, Func<S, A, S> firstFold, Func<S, B, S> secondFold, Func<S, C, S> thirdFold, Func<S, D, S> fourthFold, Func<S, E, S> fifthFold)
	{
		return fifthFold(fourthFold(thirdFold(secondFold(firstFold(state, self.Item1), self.Item2), self.Item3), self.Item4), self.Item5);
	}

	[Pure]
	public static S QuintFoldBack<A, B, C, D, E, S>(this (A, B, C, D, E) self, S state, Func<S, E, S> firstFold, Func<S, D, S> secondFold, Func<S, C, S> thirdFold, Func<S, B, S> fourthFold, Func<S, A, S> fifthFold)
	{
		return fifthFold(fourthFold(thirdFold(secondFold(firstFold(state, self.Item5), self.Item4), self.Item3), self.Item2), self.Item1);
	}
}
public static class ValueTuple6Extensions
{
	[Pure]
	public static (A, B, C, D, E, F, G) Add<A, B, C, D, E, F, G>(this (A, B, C, D, E, F) self, G seventh)
	{
		return (self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, seventh);
	}

	[Pure]
	public static (A, B, C, D, E, F) Append<SemiA, SemiB, SemiC, SemiD, SemiE, SemiF, A, B, C, D, E, F>(this (A, B, C, D, E, F) a, (A, B, C, D, E, F) b) where SemiA : struct, Semigroup<A> where SemiB : struct, Semigroup<B> where SemiC : struct, Semigroup<C> where SemiD : struct, Semigroup<D> where SemiE : struct, Semigroup<E> where SemiF : struct, Semigroup<F>
	{
		return (default(SemiA).Append(a.Item1, b.Item1), default(SemiB).Append(a.Item2, b.Item2), default(SemiC).Append(a.Item3, b.Item3), default(SemiD).Append(a.Item4, b.Item4), default(SemiE).Append(a.Item5, b.Item5), default(SemiF).Append(a.Item6, b.Item6));
	}

	[Pure]
	public static A Append<SemiA, A>(this (A, A, A, A, A, A) a) where SemiA : struct, Semigroup<A>
	{
		return default(SemiA).Append(a.Item1, default(SemiA).Append(a.Item2, default(SemiA).Append(a.Item3, default(SemiA).Append(a.Item4, default(SemiA).Append(a.Item5, a.Item6)))));
	}

	[Pure]
	public static (A, B, C, D, E, F) Concat<MonoidA, MonoidB, MonoidC, MonoidD, MonoidE, MonoidF, A, B, C, D, E, F>(this (A, B, C, D, E, F) a, (A, B, C, D, E, F) b) where MonoidA : struct, Monoid<A> where MonoidB : struct, Monoid<B> where MonoidC : struct, Monoid<C> where MonoidD : struct, Monoid<D> where MonoidE : struct, Monoid<E> where MonoidF : struct, Monoid<F>
	{
		return (TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }), TypeClass.mconcat<MonoidB, B>(new B[2] { a.Item2, b.Item2 }), TypeClass.mconcat<MonoidC, C>(new C[2] { a.Item3, b.Item3 }), TypeClass.mconcat<MonoidD, D>(new D[2] { a.Item4, b.Item4 }), TypeClass.mconcat<MonoidE, E>(new E[2] { a.Item5, b.Item5 }), TypeClass.mconcat<MonoidF, F>(new F[2] { a.Item6, b.Item6 }));
	}

	[Pure]
	public static A Concat<MonoidA, A>(this (A, A, A, A, A, A) a) where MonoidA : struct, Monoid<A>
	{
		return TypeClass.mconcat<MonoidA, A>(new A[6] { a.Item1, a.Item2, a.Item3, a.Item4, a.Item5, a.Item6 });
	}

	[Pure]
	public static A Head<A, B, C, D, E, F>(this (A, B, C, D, E, F) self)
	{
		return self.Item1;
	}

	[Pure]
	public static F Last<A, B, C, D, E, F>(this (A, B, C, D, E, F) self)
	{
		return self.Item6;
	}

	[Pure]
	public static (B, C, D, E, F) Tail<A, B, C, D, E, F>(this (A, B, C, D, E, F) self)
	{
		return (self.Item2, self.Item3, self.Item4, self.Item5, self.Item6);
	}

	[Pure]
	public static A Sum<NUM, A>(this (A, A, A, A, A, A) self) where NUM : struct, Num<A>
	{
		return TypeClass.sum<NUM, FoldTuple<A>, (A, A, A, A, A, A), A>(self);
	}

	[Pure]
	public static A Product<NUM, A>(this (A, A, A, A, A, A) self) where NUM : struct, Num<A>
	{
		return TypeClass.product<NUM, FoldTuple<A>, (A, A, A, A, A, A), A>(self);
	}

	[Pure]
	public static bool Contains<EQ, A>(this (A, A, A, A, A, A) self, A value) where EQ : struct, Eq<A>
	{
		if (!default(EQ).Equals(self.Item1, value) && !default(EQ).Equals(self.Item2, value) && !default(EQ).Equals(self.Item3, value) && !default(EQ).Equals(self.Item4, value) && !default(EQ).Equals(self.Item5, value))
		{
			return default(EQ).Equals(self.Item6, value);
		}
		return true;
	}

	[Pure]
	public static R Map<A, B, C, D, E, F, R>(this (A, B, C, D, E, F) self, Func<(A, B, C, D, E, F), R> map)
	{
		return map(self);
	}

	[Pure]
	public static R Map<A, B, C, D, E, F, R>(this (A, B, C, D, E, F) self, Func<A, B, C, D, E, F, R> map)
	{
		return map(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6);
	}

	[Pure]
	public static (U, V, W, X, Y, Z) Map<A, B, C, D, E, F, U, V, W, X, Y, Z>(this (A, B, C, D, E, F) self, Func<A, U> firstMap, Func<B, V> secondMap, Func<C, W> thirdMap, Func<D, X> fourthMap, Func<E, Y> fifthMap, Func<F, Z> sixthMap)
	{
		return (firstMap(self.Item1), secondMap(self.Item2), thirdMap(self.Item3), fourthMap(self.Item4), fifthMap(self.Item5), sixthMap(self.Item6));
	}

	[Pure]
	public static (R1, B, C, D, E, F) MapFirst<A, B, C, D, E, F, R1>(this (A, B, C, D, E, F) self, Func<A, R1> firstMap)
	{
		return (firstMap(self.Item1), self.Item2, self.Item3, self.Item4, self.Item5, self.Item6);
	}

	[Pure]
	public static (A, R2, C, D, E, F) MapSecond<A, B, C, D, E, F, R2>(this (A, B, C, D, E, F) self, Func<B, R2> secondMap)
	{
		return (self.Item1, secondMap(self.Item2), self.Item3, self.Item4, self.Item5, self.Item6);
	}

	[Pure]
	public static (A, B, R3, D, E, F) MapThird<A, B, C, D, E, F, R3>(this (A, B, C, D, E, F) self, Func<C, R3> thirdMap)
	{
		return (self.Item1, self.Item2, thirdMap(self.Item3), self.Item4, self.Item5, self.Item6);
	}

	[Pure]
	public static (A, B, C, R4, E, F) MapFourth<A, B, C, D, E, F, R4>(this (A, B, C, D, E, F) self, Func<D, R4> fourthMap)
	{
		return (self.Item1, self.Item2, self.Item3, fourthMap(self.Item4), self.Item5, self.Item6);
	}

	[Pure]
	public static (A, B, C, D, R5, F) MapFifth<A, B, C, D, E, F, R5>(this (A, B, C, D, E, F) self, Func<E, R5> fifthMap)
	{
		return (self.Item1, self.Item2, self.Item3, self.Item4, fifthMap(self.Item5), self.Item6);
	}

	[Pure]
	public static (A, B, C, D, E, R6) MapSixth<A, B, C, D, E, F, R6>(this (A, B, C, D, E, F) self, Func<F, R6> sixthMap)
	{
		return (self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, sixthMap(self.Item6));
	}

	[Pure]
	public static (U, V, W, X, Y, Z) Select<A, B, C, D, E, F, U, V, W, X, Y, Z>(this (A, B, C, D, E, F) self, Func<(A, B, C, D, E, F), (U, V, W, X, Y, Z)> map)
	{
		return map(self);
	}

	public static Unit Iter<A, B, C, D, E, F>(this (A, B, C, D, E, F) self, Action<A, B, C, D, E, F> func)
	{
		func(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6);
		return Unit.Default;
	}

	public static Unit Iter<A, B, C, D, E, F>(this (A, B, C, D, E, F) self, Action<A> first, Action<B> second, Action<C> third, Action<D> fourth, Action<E> fifth, Action<F> sixth)
	{
		first(self.Item1);
		second(self.Item2);
		third(self.Item3);
		fourth(self.Item4);
		fifth(self.Item5);
		sixth(self.Item6);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<A, B, C, D, E, F, S>(this (A, B, C, D, E, F) self, S state, Func<S, A, B, C, D, E, F, S> fold)
	{
		return fold(state, self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6);
	}

	[Pure]
	public static S SextFold<A, B, C, D, E, F, S>(this (A, B, C, D, E, F) self, S state, Func<S, A, S> firstFold, Func<S, B, S> secondFold, Func<S, C, S> thirdFold, Func<S, D, S> fourthFold, Func<S, E, S> fifthFold, Func<S, F, S> sixthFold)
	{
		return sixthFold(fifthFold(fourthFold(thirdFold(secondFold(firstFold(state, self.Item1), self.Item2), self.Item3), self.Item4), self.Item5), self.Item6);
	}

	[Pure]
	public static S SextFoldBack<A, B, C, D, E, F, S>(this (A, B, C, D, E, F) self, S state, Func<S, F, S> firstFold, Func<S, E, S> secondFold, Func<S, D, S> thirdFold, Func<S, C, S> fourthFold, Func<S, B, S> fifthFold, Func<S, A, S> sixthFold)
	{
		return sixthFold(fifthFold(fourthFold(thirdFold(secondFold(firstFold(state, self.Item6), self.Item5), self.Item4), self.Item3), self.Item2), self.Item1);
	}
}
public static class ValueTuple7Extensions
{
	[Pure]
	public static (A, B, C, D, E, F, G, H) Add<A, B, C, D, E, F, G, H>(this (A, B, C, D, E, F, G) self, H eighth)
	{
		return (self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, self.Item7, eighth);
	}

	[Pure]
	public static (A, B, C, D, E, F, G) Append<SemiA, SemiB, SemiC, SemiD, SemiE, SemiF, SemiG, A, B, C, D, E, F, G>(this (A, B, C, D, E, F, G) a, (A, B, C, D, E, F, G) b) where SemiA : struct, Semigroup<A> where SemiB : struct, Semigroup<B> where SemiC : struct, Semigroup<C> where SemiD : struct, Semigroup<D> where SemiE : struct, Semigroup<E> where SemiF : struct, Semigroup<F> where SemiG : struct, Semigroup<G>
	{
		return (default(SemiA).Append(a.Item1, b.Item1), default(SemiB).Append(a.Item2, b.Item2), default(SemiC).Append(a.Item3, b.Item3), default(SemiD).Append(a.Item4, b.Item4), default(SemiE).Append(a.Item5, b.Item5), default(SemiF).Append(a.Item6, b.Item6), default(SemiG).Append(a.Item7, b.Item7));
	}

	[Pure]
	public static A Append<SemiA, A>(this (A, A, A, A, A, A, A) a) where SemiA : struct, Semigroup<A>
	{
		return default(SemiA).Append(a.Item1, default(SemiA).Append(a.Item2, default(SemiA).Append(a.Item3, default(SemiA).Append(a.Item4, default(SemiA).Append(a.Item5, default(SemiA).Append(a.Item6, a.Item7))))));
	}

	[Pure]
	public static (A, B, C, D, E, F, G) Concat<MonoidA, MonoidB, MonoidC, MonoidD, MonoidE, MonoidF, MonoidG, A, B, C, D, E, F, G>(this (A, B, C, D, E, F, G) a, (A, B, C, D, E, F, G) b) where MonoidA : struct, Monoid<A> where MonoidB : struct, Monoid<B> where MonoidC : struct, Monoid<C> where MonoidD : struct, Monoid<D> where MonoidE : struct, Monoid<E> where MonoidF : struct, Monoid<F> where MonoidG : struct, Monoid<G>
	{
		return (TypeClass.mconcat<MonoidA, A>(new A[2] { a.Item1, b.Item1 }), TypeClass.mconcat<MonoidB, B>(new B[2] { a.Item2, b.Item2 }), TypeClass.mconcat<MonoidC, C>(new C[2] { a.Item3, b.Item3 }), TypeClass.mconcat<MonoidD, D>(new D[2] { a.Item4, b.Item4 }), TypeClass.mconcat<MonoidE, E>(new E[2] { a.Item5, b.Item5 }), TypeClass.mconcat<MonoidF, F>(new F[2] { a.Item6, b.Item6 }), TypeClass.mconcat<MonoidG, G>(new G[2] { a.Item7, b.Item7 }));
	}

	[Pure]
	public static A Concat<MonoidA, A>(this (A, A, A, A, A, A, A) a) where MonoidA : struct, Monoid<A>
	{
		return TypeClass.mconcat<MonoidA, A>(new A[7] { a.Item1, a.Item2, a.Item3, a.Item4, a.Item5, a.Item6, a.Item7 });
	}

	[Pure]
	public static A Head<A, B, C, D, E, F, G>(this (A, B, C, D, E, F, G) self)
	{
		return self.Item1;
	}

	[Pure]
	public static G Last<A, B, C, D, E, F, G>(this (A, B, C, D, E, F, G) self)
	{
		return self.Item7;
	}

	[Pure]
	public static (B, C, D, E, F, G) Tail<A, B, C, D, E, F, G>(this (A, B, C, D, E, F, G) self)
	{
		return (self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static A Sum<NUM, A>(this (A, A, A, A, A, A, A) self) where NUM : struct, Num<A>
	{
		return TypeClass.sum<NUM, FoldTuple<A>, (A, A, A, A, A, A, A), A>(self);
	}

	[Pure]
	public static A Product<NUM, A>(this (A, A, A, A, A, A, A) self) where NUM : struct, Num<A>
	{
		return TypeClass.product<NUM, FoldTuple<A>, (A, A, A, A, A, A, A), A>(self);
	}

	[Pure]
	public static bool Contains<EQ, A>(this (A, A, A, A, A, A, A) self, A value) where EQ : struct, Eq<A>
	{
		if (!default(EQ).Equals(self.Item1, value) && !default(EQ).Equals(self.Item2, value) && !default(EQ).Equals(self.Item3, value) && !default(EQ).Equals(self.Item4, value) && !default(EQ).Equals(self.Item5, value) && !default(EQ).Equals(self.Item6, value))
		{
			return default(EQ).Equals(self.Item7, value);
		}
		return true;
	}

	[Pure]
	public static R Map<A, B, C, D, E, F, G, R>(this (A, B, C, D, E, F, G) self, Func<(A, B, C, D, E, F, G), R> map)
	{
		return map(self);
	}

	[Pure]
	public static R Map<A, B, C, D, E, F, G, R>(this (A, B, C, D, E, F, G) self, Func<A, B, C, D, E, F, G, R> map)
	{
		return map(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static (T, U, V, W, X, Y, Z) Map<A, B, C, D, E, F, G, T, U, V, W, X, Y, Z>(this (A, B, C, D, E, F, G) self, Func<A, T> firstMap, Func<B, U> secondMap, Func<C, V> thirdMap, Func<D, W> fourthMap, Func<E, X> fifthMap, Func<F, Y> sixthMap, Func<G, Z> seventhMap)
	{
		return (firstMap(self.Item1), secondMap(self.Item2), thirdMap(self.Item3), fourthMap(self.Item4), fifthMap(self.Item5), sixthMap(self.Item6), seventhMap(self.Item7));
	}

	[Pure]
	public static (R1, B, C, D, E, F, G) MapFirst<A, B, C, D, E, F, G, R1>(this (A, B, C, D, E, F, G) self, Func<A, R1> firstMap)
	{
		return (firstMap(self.Item1), self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static (A, R2, C, D, E, F, G) MapSecond<A, B, C, D, E, F, G, R2>(this (A, B, C, D, E, F, G) self, Func<B, R2> secondMap)
	{
		return (self.Item1, secondMap(self.Item2), self.Item3, self.Item4, self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static (A, B, R3, D, E, F, G) MapThird<A, B, C, D, E, F, G, R3>(this (A, B, C, D, E, F, G) self, Func<C, R3> thirdMap)
	{
		return (self.Item1, self.Item2, thirdMap(self.Item3), self.Item4, self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static (A, B, C, R4, E, F, G) MapFourth<A, B, C, D, E, F, G, R4>(this (A, B, C, D, E, F, G) self, Func<D, R4> fourthMap)
	{
		return (self.Item1, self.Item2, self.Item3, fourthMap(self.Item4), self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static (A, B, C, D, R5, F, G) MapFifth<A, B, C, D, E, F, G, R5>(this (A, B, C, D, E, F, G) self, Func<E, R5> fifthMap)
	{
		return (self.Item1, self.Item2, self.Item3, self.Item4, fifthMap(self.Item5), self.Item6, self.Item7);
	}

	[Pure]
	public static (A, B, C, D, E, R6, G) MapSixth<A, B, C, D, E, F, G, R6>(this (A, B, C, D, E, F, G) self, Func<F, R6> sixthMap)
	{
		return (self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, sixthMap(self.Item6), self.Item7);
	}

	[Pure]
	public static (A, B, C, D, E, F, R7) MapSeventh<A, B, C, D, E, F, G, R7>(this (A, B, C, D, E, F, G) self, Func<G, R7> seventhMap)
	{
		return (self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, seventhMap(self.Item7));
	}

	[Pure]
	public static (U, V, W, X, Y, Z) Select<A, B, C, D, E, F, G, U, V, W, X, Y, Z>(this (A, B, C, D, E, F, G) self, Func<(A, B, C, D, E, F, G), (U, V, W, X, Y, Z)> map)
	{
		return map(self);
	}

	public static Unit Iter<A, B, C, D, E, F, G>(this (A, B, C, D, E, F, G) self, Action<A, B, C, D, E, F, G> func)
	{
		func(self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, self.Item7);
		return Unit.Default;
	}

	public static Unit Iter<A, B, C, D, E, F, G>(this (A, B, C, D, E, F, G) self, Action<A> first, Action<B> second, Action<C> third, Action<D> fourth, Action<E> fifth, Action<F> sixth, Action<G> seventh)
	{
		first(self.Item1);
		second(self.Item2);
		third(self.Item3);
		fourth(self.Item4);
		fifth(self.Item5);
		sixth(self.Item6);
		seventh(self.Item7);
		return Unit.Default;
	}

	[Pure]
	public static S Fold<A, B, C, D, E, F, G, S>(this (A, B, C, D, E, F, G) self, S state, Func<S, A, B, C, D, E, F, G, S> fold)
	{
		return fold(state, self.Item1, self.Item2, self.Item3, self.Item4, self.Item5, self.Item6, self.Item7);
	}

	[Pure]
	public static S SeptFold<A, B, C, D, E, F, G, S>(this (A, B, C, D, E, F, G) self, S state, Func<S, A, S> firstFold, Func<S, B, S> secondFold, Func<S, C, S> thirdFold, Func<S, D, S> fourthFold, Func<S, E, S> fifthFold, Func<S, F, S> sixthFold, Func<S, G, S> seventhFold)
	{
		return seventhFold(sixthFold(fifthFold(fourthFold(thirdFold(secondFold(firstFold(state, self.Item1), self.Item2), self.Item3), self.Item4), self.Item5), self.Item6), self.Item7);
	}

	[Pure]
	public static S SeptFoldBack<A, B, C, D, E, F, G, S>(this (A, B, C, D, E, F, G) self, S state, Func<S, G, S> firstFold, Func<S, F, S> secondFold, Func<S, E, S> thirdFold, Func<S, D, S> fourthFold, Func<S, C, S> fifthFold, Func<S, B, S> sixthFold, Func<S, A, S> seventhFold)
	{
		return seventhFold(sixthFold(fifthFold(fourthFold(thirdFold(secondFold(firstFold(state, self.Item7), self.Item6), self.Item5), self.Item4), self.Item3), self.Item2), self.Item1);
	}
}
public static class QueryExtensions
{
	public static T Head<T>(this IQueryable<T> list)
	{
		return Query.head(list);
	}

	public static Option<T> HeadOrNone<T>(this IQueryable<T> list)
	{
		return Query.headOrNone(list);
	}

	public static Validation<S, T> HeadOrInvalid<S, T>(this IQueryable<T> list, S fail)
	{
		return Query.headOrInvalid(list, fail);
	}

	public static Either<S, T> HeadOrLeft<S, T>(this IQueryable<T> list, S left)
	{
		return Query.headOrLeft(list, left);
	}

	public static IQueryable<T> Tail<T>(this IQueryable<T> list)
	{
		return Query.tail(list);
	}

	public static IQueryable<R> Map<T, R>(this IQueryable<T> list, Expression<Func<T, R>> map)
	{
		return Query.map(list, map);
	}

	public static IQueryable<R> Map<T, R>(this IQueryable<T> list, Expression<Func<int, T, R>> map)
	{
		return Query.map(list, map);
	}

	public static IQueryable<T> Filter<T>(this IQueryable<T> list, Expression<Func<T, bool>> predicate)
	{
		return Query.filter(list, predicate);
	}

	public static IQueryable<U> Choose<T, U>(this IQueryable<T> list, Expression<Func<T, Option<U>>> selector)
	{
		return Query.choose(list, selector);
	}

	public static IQueryable<U> Choose<T, U>(this IQueryable<T> list, Expression<Func<int, T, Option<U>>> selector)
	{
		return Query.choose(list, selector);
	}

	public static IQueryable<R> Collect<T, R>(this IQueryable<T> list, Expression<Func<T, IEnumerable<R>>> map)
	{
		return Query.collect(list, map);
	}

	public static IQueryable<T> Rev<T>(this IQueryable<T> list)
	{
		return Query.rev(list);
	}

	public static IQueryable<T> Append<T>(this IQueryable<T> lhs, IQueryable<T> rhs)
	{
		return Query.append(lhs, rhs);
	}

	public static S Fold<S, T>(this IQueryable<T> list, S state, Expression<Func<S, T, S>> folder)
	{
		return Query.fold(list, state, folder);
	}

	public static S FoldBack<S, T>(this IQueryable<T> list, S state, Expression<Func<S, T, S>> folder)
	{
		return Query.foldBack(list, state, folder);
	}

	public static T Reduce<T>(this IQueryable<T> list, Expression<Func<T, T, T>> reducer)
	{
		return Query.reduce(list, reducer);
	}

	public static T ReduceBack<T>(this IQueryable<T> list, Expression<Func<T, T, T>> reducer)
	{
		return Query.reduceBack(list, reducer);
	}

	public static Lst<T> Freeze<T>(this IQueryable<T> list)
	{
		return Query.freeze(list);
	}

	public static IQueryable<V> Zip<T, U, V>(this IQueryable<T> list, IEnumerable<U> other, Expression<Func<T, U, V>> zipper)
	{
		return Query.zip(list, other, zipper);
	}

	public static int Length<T>(this IQueryable<T> list)
	{
		return Query.length(list);
	}

	public static bool ForAll<T>(this IQueryable<T> list, Expression<Func<T, bool>> pred)
	{
		return Query.forall(list, pred);
	}

	public static IQueryable<T> Distinct<T>(this IQueryable<T> list)
	{
		return Query.distinct(list);
	}

	public static bool Exists<T>(this IQueryable<T> list, Expression<Func<T, bool>> pred)
	{
		return Query.exists(list, pred);
	}
}
public static class ArrExtensions
{
	[Pure]
	public static A[] Flatten<A>(this A[][] ma)
	{
		return ma.Bind(Prelude.identity).ToArray();
	}

	[Pure]
	public static Arr<A> Flatten<A>(this Arr<Arr<A>> ma)
	{
		return ma.Bind<A>(Prelude.identity);
	}

	[Pure]
	public static TAccumulate Aggregate<TSource, TAccumulate>(this Arr<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func)
	{
		return source.Value.Aggregate(seed, func);
	}

	[Pure]
	public static TResult Aggregate<TSource, TAccumulate, TResult>(this Arr<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func, Func<TAccumulate, TResult> resultSelector)
	{
		return source.Value.Aggregate(seed, func, resultSelector);
	}

	[Pure]
	public static TSource Aggregate<TSource>(this Arr<TSource> source, Func<TSource, TSource, TSource> func)
	{
		return source.Value.Aggregate(func);
	}

	[Pure]
	public static bool All<TSource>(this Arr<TSource> source, Func<TSource, bool> predicate)
	{
		return source.Value.All(predicate);
	}

	[Pure]
	public static bool Any<TSource>(this Arr<TSource> source)
	{
		return source.Value.Any();
	}

	[Pure]
	public static bool Any<TSource>(this Arr<TSource> source, Func<TSource, bool> predicate)
	{
		return source.Value.Any(predicate);
	}

	[Pure]
	public static IEnumerable<TSource> AsEnumerable<TSource>(this Arr<TSource> source)
	{
		return source.Value.AsEnumerable();
	}

	[Pure]
	public static IQueryable<TElement> AsQueryable<TElement>(this Arr<TElement> source)
	{
		return source.Value.AsQueryable().AsQueryable();
	}

	[Pure]
	public static decimal Average(this Arr<decimal> source)
	{
		return source.Value.Average();
	}

	[Pure]
	public static decimal Average<TSource>(this Arr<TSource> source, Func<TSource, decimal> selector)
	{
		return source.Value.Average(selector);
	}

	[Pure]
	public static decimal? Average(this Arr<decimal?> source)
	{
		return source.Value.Average();
	}

	[Pure]
	public static decimal? Average<TSource>(this Arr<TSource> source, Func<TSource, decimal?> selector)
	{
		return source.Value.Average(selector);
	}

	[Pure]
	public static double Average(this Arr<double> source)
	{
		return source.Value.Average();
	}

	[Pure]
	public static double Average(this Arr<int> source)
	{
		return source.Value.Average();
	}

	[Pure]
	public static double Average(this Arr<long> source)
	{
		return source.Value.Average();
	}

	[Pure]
	public static double Average<TSource>(this Arr<TSource> source, Func<TSource, double> selector)
	{
		return source.Value.Average(selector);
	}

	[Pure]
	public static double Average<TSource>(this Arr<TSource> source, Func<TSource, int> selector)
	{
		return source.Value.Average(selector);
	}

	[Pure]
	public static double Average<TSource>(this Arr<TSource> source, Func<TSource, long> selector)
	{
		return source.Value.Average(selector);
	}

	[Pure]
	public static double? Average(this Arr<double?> source)
	{
		return source.Value.Average();
	}

	[Pure]
	public static double? Average(this Arr<int?> source)
	{
		return source.Value.Average();
	}

	[Pure]
	public static double? Average(this Arr<long?> source)
	{
		return source.Value.Average();
	}

	[Pure]
	public static double? Average<TSource>(this Arr<TSource> source, Func<TSource, double?> selector)
	{
		return source.Value.Average(selector);
	}

	[Pure]
	public static double? Average<TSource>(this Arr<TSource> source, Func<TSource, int?> selector)
	{
		return source.Value.Average(selector);
	}

	[Pure]
	public static double? Average<TSource>(this Arr<TSource> source, Func<TSource, long?> selector)
	{
		return source.Value.Average(selector);
	}

	[Pure]
	public static float Average(this Arr<float> source)
	{
		return source.Value.Average();
	}

	[Pure]
	public static float Average<TSource>(this Arr<TSource> source, Func<TSource, float> selector)
	{
		return source.Value.Average(selector);
	}

	[Pure]
	public static float? Average(this Arr<float?> source)
	{
		return source.Value.Average();
	}

	[Pure]
	public static float? Average<TSource>(this Arr<TSource> source, Func<TSource, float?> selector)
	{
		return source.Value.Average(selector);
	}

	[Pure]
	public static IEnumerable<TSource> Concat<TSource>(this Arr<TSource> first, IEnumerable<TSource> second)
	{
		return first.Value.Concat(second);
	}

	[Pure]
	public static bool Contains<TSource>(this Arr<TSource> source, TSource value)
	{
		return source.Value.Contains(value);
	}

	[Pure]
	public static bool Contains<TSource>(this Arr<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
	{
		return source.Value.Contains(value, comparer);
	}

	[Pure]
	public static int Count<TSource>(this Arr<TSource> source)
	{
		return source.Value.Count();
	}

	[Pure]
	public static int Count<TSource>(this Arr<TSource> source, Func<TSource, bool> predicate)
	{
		return source.Value.Count(predicate);
	}

	[Pure]
	public static IEnumerable<TSource> DefaultIfEmpty<TSource>(this Arr<TSource> source)
	{
		return source.Value.DefaultIfEmpty();
	}

	[Pure]
	public static IEnumerable<TSource> DefaultIfEmpty<TSource>(this Arr<TSource> source, TSource defaultValue)
	{
		return source.Value.DefaultIfEmpty(defaultValue);
	}

	[Pure]
	public static IEnumerable<TSource> Distinct<TSource>(this Arr<TSource> source)
	{
		return source.Value.Distinct();
	}

	[Pure]
	public static IEnumerable<TSource> Distinct<TSource>(this Arr<TSource> source, IEqualityComparer<TSource> comparer)
	{
		return source.Value.Distinct(comparer);
	}

	[Pure]
	public static TSource ElementAt<TSource>(this Arr<TSource> source, int index)
	{
		return source.Value.ElementAt(index);
	}

	[Pure]
	public static TSource ElementAtOrDefault<TSource>(this Arr<TSource> source, int index)
	{
		return source.Value.ElementAtOrDefault(index);
	}

	[Pure]
	public static IEnumerable<TSource> Except<TSource>(this Arr<TSource> first, IEnumerable<TSource> second)
	{
		return first.Value.Except(second);
	}

	[Pure]
	public static IEnumerable<TSource> Except<TSource>(this Arr<TSource> first, IEnumerable<TSource> second, IEquali

BepInEx/plugins/LanguageExt/LanguageExt.Rx.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using System.Threading.Tasks;
using LanguageExt.Common;
using LanguageExt.Effects.Traits;
using LanguageExt.TypeClasses;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Paul Louth")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright (c) Paul Louth. All rights reserved.")]
[assembly: AssemblyDescription("Support for Reactive Extensions overloads for various types in the LanguageExt.Core")]
[assembly: AssemblyFileVersion("4.4.5.0")]
[assembly: AssemblyInformationalVersion("4.4.5-dev.5+d8167ed3491f17e813ed9e9422b0384b15b2982d")]
[assembly: AssemblyProduct("LanguageExt.Rx")]
[assembly: AssemblyTitle("LanguageExt.Rx")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Lordfirespeed/LanguageExtThunderstore")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LanguageExt
{
	public static class AffRxExtensions
	{
		public static Aff<Unit> Consume<A>(this IObservable<A> ma, Func<A, Aff<Unit>> next, CancellationToken token = default(CancellationToken))
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			return Prelude.AffMaybe<Unit>((Func<ValueTask<Fin<Unit>>>)async delegate
			{
				A nextValue = default(A);
				AutoResetEvent wait = new AutoResetEvent(initialState: false);
				using (ObservableExtensions.Subscribe<A>(ma, (Action<A>)delegate(A x)
				{
					nextValue = x;
					wait.Set();
				}))
				{
					while (token == default(CancellationToken) || !token.IsCancellationRequested)
					{
						wait.WaitOne();
						Fin<Unit> val = await next(nextValue).Run();
						if (val.IsFail)
						{
							return Prelude.FinFail<Unit>((Error)val);
						}
					}
					return Fin<Unit>.op_Implicit(Prelude.unit);
				}
			});
		}

		public static Aff<RT, Unit> Consume<RT, A>(this IObservable<A> ma, Func<A, Aff<RT, Unit>> next) where RT : struct, HasCancel<RT>
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			return Prelude.AffMaybe<RT, Unit>((Func<RT, ValueTask<Fin<Unit>>>)async delegate(RT env)
			{
				A nextValue = default(A);
				AutoResetEvent wait = new AutoResetEvent(initialState: false);
				using (ObservableExtensions.Subscribe<A>(ma, (Action<A>)delegate(A x)
				{
					nextValue = x;
					wait.Set();
				}))
				{
					while (((HasCancel<RT>)env).CancellationToken == default(CancellationToken) || !((HasCancel<RT>)env).CancellationToken.IsCancellationRequested)
					{
						wait.WaitOne();
						Fin<Unit> val = await next(nextValue).Run(env);
						if (val.IsFail)
						{
							return Prelude.FinFail<Unit>((Error)val);
						}
					}
					return Fin<Unit>.op_Implicit(Prelude.unit);
				}
			});
		}

		public static Aff<S> Fold<S, A>(this IObservable<A> ma, S state, Func<S, A, Aff<S>> next, CancellationToken token = default(CancellationToken))
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			return Prelude.AffMaybe<S>((Func<ValueTask<Fin<S>>>)async delegate
			{
				A nextValue = default(A);
				AutoResetEvent wait = new AutoResetEvent(initialState: false);
				using (ObservableExtensions.Subscribe<A>(ma, (Action<A>)delegate(A x)
				{
					nextValue = x;
					wait.Set();
				}))
				{
					while (token == default(CancellationToken) || !token.IsCancellationRequested)
					{
						wait.WaitOne();
						Fin<S> val = await next(state, nextValue).Run();
						if (val.IsFail)
						{
							return Prelude.FinFail<S>((Error)val);
						}
						state = (S)val;
					}
					return Fin<S>.op_Implicit(state);
				}
			});
		}

		public static Aff<RT, S> Fold<RT, S, A>(this IObservable<A> ma, S state, Func<S, A, Aff<RT, S>> next) where RT : struct, HasCancel<RT>
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			return Prelude.AffMaybe<RT, S>((Func<RT, ValueTask<Fin<S>>>)async delegate(RT env)
			{
				A nextValue = default(A);
				AutoResetEvent wait = new AutoResetEvent(initialState: false);
				using (ObservableExtensions.Subscribe<A>(ma, (Action<A>)delegate(A x)
				{
					nextValue = x;
					wait.Set();
				}))
				{
					while (((HasCancel<RT>)env).CancellationToken == default(CancellationToken) || !((HasCancel<RT>)env).CancellationToken.IsCancellationRequested)
					{
						wait.WaitOne();
						Fin<S> val = await next(state, nextValue).Run(env);
						if (val.IsFail)
						{
							return Prelude.FinFail<S>((Error)val);
						}
						state = (S)val;
					}
					return Fin<S>.op_Implicit(state);
				}
			});
		}
	}
	public static class AtomExtensions
	{
		[Pure]
		public static IObservable<A> OnChange<A>(this Atom<A> atom)
		{
			return Observable.FromEvent<A>((Action<Action<A>>)delegate(Action<A> add)
			{
				atom.Change += add.Invoke;
			}, (Action<Action<A>>)delegate(Action<A> remove)
			{
				atom.Change -= remove.Invoke;
			});
		}

		[Pure]
		public static IObservable<A> OnChange<M, A>(this Atom<M, A> atom)
		{
			return Observable.FromEvent<A>((Action<Action<A>>)delegate(Action<A> add)
			{
				atom.Change += add.Invoke;
			}, (Action<Action<A>>)delegate(Action<A> remove)
			{
				atom.Change -= remove.Invoke;
			});
		}

		[Pure]
		public static IObservable<A> OnChange<A>(this Ref<A> atom)
		{
			return Observable.FromEvent<A>((Action<Action<A>>)delegate(Action<A> add)
			{
				atom.Change += add.Invoke;
			}, (Action<Action<A>>)delegate(Action<A> remove)
			{
				atom.Change -= remove.Invoke;
			});
		}

		[Pure]
		public static IObservable<HashMapPatch<K, V>> OnChange<K, V>(this AtomHashMap<K, V> atom)
		{
			return Observable.FromEvent<HashMapPatch<K, V>>((Action<Action<HashMapPatch<K, V>>>)delegate(Action<HashMapPatch<K, V>> add)
			{
				atom.Change += add.Invoke;
			}, (Action<Action<HashMapPatch<K, V>>>)delegate(Action<HashMapPatch<K, V>> remove)
			{
				atom.Change -= remove.Invoke;
			});
		}

		[Pure]
		public static IObservable<HashMapPatch<EqK, K, V>> OnChange<EqK, K, V>(this AtomHashMap<EqK, K, V> atom) where EqK : struct, Eq<K>
		{
			return Observable.FromEvent<HashMapPatch<EqK, K, V>>((Action<Action<HashMapPatch<EqK, K, V>>>)delegate(Action<HashMapPatch<EqK, K, V>> add)
			{
				atom.Change += add.Invoke;
			}, (Action<Action<HashMapPatch<EqK, K, V>>>)delegate(Action<HashMapPatch<EqK, K, V>> remove)
			{
				atom.Change -= remove.Invoke;
			});
		}

		[Pure]
		public static IObservable<(K, Change<V>)> OnEntryChange<K, V>(this AtomHashMap<K, V> atom)
		{
			return Observable.SelectMany<HashMapPatch<K, V>, (K, Change<V>)>(atom.OnChange<K, V>(), (Func<HashMapPatch<K, V>, IEnumerable<(K, Change<V>)>>)((HashMapPatch<K, V> p) => ListExtensions.Filter<(K, Change<V>)>(p.Changes.AsEnumerable(), (Func<(K, Change<V>), bool>)(((K Key, Change<V> Value) c) => c.Value.HasChanged))));
		}

		[Pure]
		public static IObservable<(K, Change<V>)> OnEntryChange<EqK, K, V>(this AtomHashMap<EqK, K, V> atom) where EqK : struct, Eq<K>
		{
			return Observable.SelectMany<HashMapPatch<EqK, K, V>, (K, Change<V>)>(atom.OnChange<EqK, K, V>(), (Func<HashMapPatch<EqK, K, V>, IEnumerable<(K, Change<V>)>>)((HashMapPatch<EqK, K, V> p) => ListExtensions.Filter<(K, Change<V>)>(p.Changes.AsEnumerable(), (Func<(K, Change<V>), bool>)(((K Key, Change<V> Value) c) => c.Value.HasChanged))));
		}

		[Pure]
		public static IObservable<HashMap<EqK, K, V>> OnMapChange<EqK, K, V>(this AtomHashMap<EqK, K, V> atom) where EqK : struct, Eq<K>
		{
			return Observable.Select<HashMapPatch<EqK, K, V>, HashMap<EqK, K, V>>(atom.OnChange<EqK, K, V>(), (Func<HashMapPatch<EqK, K, V>, HashMap<EqK, K, V>>)((HashMapPatch<EqK, K, V> p) => p.To));
		}
	}
	internal static class CastExtensions
	{
		public static A Cast<A>(this Option<A> ma)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return (A)ma;
		}

		public static A Cast<A>(this OptionUnsafe<A> ma)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return (A)ma;
		}

		public static L CastLeft<L, R>(this Either<L, R> ma)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return (L)ma;
		}

		public static R CastRight<L, R>(this Either<L, R> ma)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return (R)ma;
		}

		public static L CastLeft<L, R>(this EitherUnsafe<L, R> ma)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return (L)ma;
		}

		public static R CastRight<L, R>(this EitherUnsafe<L, R> ma)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return (R)ma;
		}
	}
	internal static class Check
	{
		internal static T NullReturn<T>(T value)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			if (!Prelude.isnull<T>(value))
			{
				return value;
			}
			return Prelude.raise<T>((Exception)new ResultIsNullException());
		}
	}
	public static class EitherRxExtensions
	{
		public unsafe static IObservable<R> ToObservable<L, R>(this Either<L, R> ma)
		{
			return ((Either<IObservable<R>, ?>*)(&ma))->Match<IObservable<R>>((Func<?, IObservable<R>>)(object)new Func<R, IObservable<R>>(Observable.Return<R>), (Func<IObservable<R>, IObservable<R>>)(object)(Func<L, IObservable<R>>)((L _) => Observable.Empty<R>()), (Func<IObservable<R>>)null);
		}

		[Pure]
		public static IObservable<R2> MatchObservable<L, R, R2>(this Either<L, IObservable<R>> self, Func<R, R2> Right, Func<L, R2> Left)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (!self.IsRight)
			{
				return Observable.Return<R2>(Check.NullReturn(Left(self.CastLeft<L, IObservable<R>>())));
			}
			return Observable.Select<R2, R2>(Observable.Select<R, R2>(self.CastRight<L, IObservable<R>>(), Right), (Func<R2, R2>)Check.NullReturn);
		}

		[Pure]
		public static IObservable<R2> MatchObservable<L, R, R2>(this IObservable<Either<L, R>> self, Func<R, R2> Right, Func<L, R2> Left)
		{
			return Observable.Select<Either<L, R>, R2>(self, (Func<Either<L, R>, R2>)((Either<L, R> either) => Prelude.match<L, R, R2>(either, Right, Left)));
		}

		[Pure]
		public unsafe static IObservable<R2> MatchObservable<L, R, R2>(this Either<L, R> ma, Func<R, IObservable<R2>> Right, Func<L, R2> Left)
		{
			return ((Either<IObservable<R2>, ?>*)(&ma))->Match<IObservable<R2>>((Func<?, IObservable<R2>>)(object)Right, (Func<IObservable<R2>, IObservable<R2>>)(object)(Func<L, IObservable<R2>>)((L l) => Observable.Return<R2>(Left(l))), (Func<IObservable<R2>>)null);
		}

		[Pure]
		public unsafe static IObservable<R2> MatchObservable<L, R, R2>(this Either<L, R> ma, Func<R, IObservable<R2>> Right, Func<L, IObservable<R2>> Left)
		{
			return ((Either<IObservable<R2>, ?>*)(&ma))->Match<IObservable<R2>>((Func<?, IObservable<R2>>)(object)Right, (Func<IObservable<R2>, IObservable<R2>>)(object)Left, (Func<IObservable<R2>>)null);
		}
	}
	public static class NullableRxExtensions
	{
		public static IObservable<A> ToObservable<A>(this A? ma) where A : struct
		{
			if (!ma.HasValue)
			{
				return Observable.Empty<A>();
			}
			return Observable.Return<A>(ma.Value);
		}

		[Pure]
		public static IObservable<R> MatchObservable<T, R>(this T? self, Func<T, IObservable<R>> Some, Func<R> None) where T : struct
		{
			if (!self.HasValue)
			{
				return Observable.Return<R>(None());
			}
			return Some(self.Value);
		}

		[Pure]
		public static IObservable<R> MatchObservable<T, R>(this IObservable<T?> self, Func<T, R> Some, Func<R> None) where T : struct
		{
			return Observable.Select<T?, R>(self, (Func<T?, R>)((T? nullable) => NullableExtensions.Match<T, R>(nullable, Some, None)));
		}

		[Pure]
		public static IObservable<R> MatchObservable<T, R>(this T? self, Func<T, IObservable<R>> Some, Func<IObservable<R>> None) where T : struct
		{
			if (!self.HasValue)
			{
				return None();
			}
			return Some(self.Value);
		}
	}
	public static class OptionRxExtensions
	{
		public static IObservable<B> Choose<A, B>(this IObservable<A> ma, Func<A, Option<B>> f)
		{
			return Observable.Select<Option<B>, B>(Observable.Where<Option<B>>(Observable.Select<A, Option<B>>(ma, f), (Func<Option<B>, bool>)((Option<B> x) => x.IsSome)), (Func<Option<B>, B>)((Option<B> x) => (B)x));
		}

		public static IObservable<A> ToObservable<A>(this Option<A> ma)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (!ma.IsSome)
			{
				return Observable.Empty<A>();
			}
			return Observable.Return<A>(ma.Cast<A>());
		}

		[Pure]
		public static IObservable<B> MatchObservable<A, B>(this Option<A> ma, Func<A, IObservable<B>> Some, Func<B> None)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (!ma.IsSome)
			{
				return Observable.Return<B>(CheckNullNoneReturn(None()));
			}
			return Observable.Select<B, B>(Some(ma.Cast<A>()), (Func<B, B>)CheckNullSomeReturn);
		}

		[Pure]
		public static IObservable<B> MatchObservable<A, B>(this Option<A> ma, Func<A, IObservable<B>> Some, Func<IObservable<B>> None)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (!ma.IsSome)
			{
				return Observable.Select<B, B>(None(), (Func<B, B>)CheckNullNoneReturn);
			}
			return Observable.Select<B, B>(Some(ma.Cast<A>()), (Func<B, B>)CheckNullSomeReturn);
		}

		[Pure]
		internal static U CheckNullReturn<U>(U value, string location)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (!Prelude.isnull<U>(value))
			{
				return value;
			}
			throw new ResultIsNullException("'" + location + "' result is null.  Not allowed.");
		}

		[Pure]
		internal static U CheckNullNoneReturn<U>(U value)
		{
			return CheckNullReturn(value, "None");
		}

		[Pure]
		internal static U CheckNullSomeReturn<U>(U value)
		{
			return CheckNullReturn(value, "Some");
		}
	}
	public static class OptionUnsafeRxExtensions
	{
		public static IObservable<A> ToObservable<A>(this OptionUnsafe<A> ma)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (!ma.IsSome)
			{
				return Observable.Empty<A>();
			}
			return Observable.Return<A>(ma.Cast<A>());
		}

		[Pure]
		public static IObservable<B> MatchObservable<A, B>(this OptionUnsafe<A> ma, Func<A, IObservable<B>> Some, Func<B> None)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (!ma.IsSome)
			{
				return Observable.Return<B>(None());
			}
			return Some(ma.Cast<A>());
		}

		[Pure]
		public static IObservable<B> MatchObservable<A, B>(this OptionUnsafe<A> ma, Func<A, IObservable<B>> Some, Func<IObservable<B>> None)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!ma.IsSome)
			{
				return None();
			}
			return Some(ma.Cast<A>());
		}
	}
	public static class PreludeRx
	{
		public static IObservable<T> delay<T>(Func<T> f, TimeSpan delayFor)
		{
			if (!(delayFor.TotalMilliseconds < 1.0))
			{
				return Observable.Take<T>(TaskObservableExtensions.ToObservable<T>(Task.Delay(delayFor).ContinueWith((Task _) => f())), 1);
			}
			return Observable.Take<T>(Observable.Return<T>(f()), 1);
		}

		public static IObservable<T> delay<T>(Func<T> f, DateTime delayUntil)
		{
			return delay(f, delayUntil.ToUniversalTime() - DateTime.UtcNow);
		}
	}
	public static class TaskTryRxExtensions
	{
		[Pure]
		public static IObservable<R> MatchObservable<A, R>(this Task<Try<A>> self, Func<A, IObservable<R>> Succ, Func<Exception, R> Fail)
		{
			return TaskTryExtensions.ToAsync<A>(self).MatchObservable(Succ, Fail);
		}

		[Pure]
		public static IObservable<R> MatchObservable<A, R>(this Task<Try<A>> self, Func<A, IObservable<R>> Succ, Func<Exception, IObservable<R>> Fail)
		{
			return TaskTryExtensions.ToAsync<A>(self).MatchObservable(Succ, Fail);
		}

		[Pure]
		public static IObservable<R> MatchObservable<A, R>(this Task<Try<A>> self, Func<A, R> Succ, Func<Exception, IObservable<R>> Fail)
		{
			return TaskTryExtensions.ToAsync<A>(self).MatchObservable(Succ, Fail);
		}
	}
	public static class TryRxExtensions
	{
		[Pure]
		public static IObservable<R> MatchObservable<A, R>(this Try<A> self, Func<A, IObservable<R>> Succ, Func<Exception, R> Fail)
		{
			return TryExtensionsAsync.ToAsync<A>(self).MatchObservable(Succ, Fail);
		}

		[Pure]
		public static IObservable<R> MatchObservable<A, R>(this Try<A> self, Func<A, IObservable<R>> Succ, Func<Exception, IObservable<R>> Fail)
		{
			return TryExtensionsAsync.ToAsync<A>(self).MatchObservable(Succ, Fail);
		}

		[Pure]
		public static IObservable<R> MatchObservable<A, R>(this Try<A> self, Func<A, R> Succ, Func<Exception, IObservable<R>> Fail)
		{
			return TryExtensionsAsync.ToAsync<A>(self).MatchObservable(Succ, Fail);
		}

		public static IObservable<R> MatchObservable<T, R>(this IObservable<Try<T>> self, Func<T, R> Succ, Func<Exception, R> Fail)
		{
			return Observable.Select<Try<T>, R>(self, (Func<Try<T>, R>)((Try<T> trySelf) => ((Result<R>)TryExtensions.Try<T>(trySelf)).Match<R>((Func<R, R>)(object)Succ, Fail)));
		}

		public static IObservable<R> MatchObservable<T, R>(this IObservable<Try<T>> self, Func<T, IObservable<R>> Succ, Func<Exception, R> Fail)
		{
			return Observable.SelectMany<IObservable<R>, R, R>(Observable.Select<Try<T>, IObservable<R>>(self, (Func<Try<T>, IObservable<R>>)((Try<T> trySelf) => ((Result<IObservable<R>>)TryExtensions.Try<T>(trySelf)).Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)Succ, (Func<Exception, IObservable<R>>)((Exception x) => Observable.Return<R>(Fail(x)))))), (Func<IObservable<R>, IObservable<R>>)((IObservable<R> tt) => tt), (Func<IObservable<R>, R, R>)((IObservable<R> tt, R t) => t));
		}

		public static IObservable<R> MatchObservable<T, R>(this IObservable<Try<T>> self, Func<T, IObservable<R>> Succ, Func<Exception, IObservable<R>> Fail)
		{
			return Observable.SelectMany<IObservable<R>, R, R>(Observable.Select<Try<T>, IObservable<R>>(self, (Func<Try<T>, IObservable<R>>)((Try<T> trySelf) => ((Result<IObservable<R>>)TryExtensions.Try<T>(trySelf)).Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)Succ, Fail))), (Func<IObservable<R>, IObservable<R>>)((IObservable<R> tt) => tt), (Func<IObservable<R>, R, R>)((IObservable<R> tt, R t) => t));
		}

		public static IObservable<R> MatchObservable<T, R>(this IObservable<Try<T>> self, Func<T, R> Succ, Func<Exception, IObservable<R>> Fail)
		{
			return Observable.SelectMany<IObservable<R>, R, R>(Observable.Select<Try<T>, IObservable<R>>(self, (Func<Try<T>, IObservable<R>>)((Try<T> trySelf) => ((Result<IObservable<R>>)TryExtensions.Try<T>(trySelf)).Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)(Func<T, IObservable<R>>)((T x) => Observable.Return<R>(Succ(x))), Fail))), (Func<IObservable<R>, IObservable<R>>)((IObservable<R> tt) => tt), (Func<IObservable<R>, R, R>)((IObservable<R> tt, R t) => t));
		}
	}
	public static class TryAsyncRxExtensions
	{
		public static IObservable<A> ToObservable<A>(this TryAsync<A> ma)
		{
			return Observable.Select<Result<A>, A>(Observable.Where<Result<A>>(TaskObservableExtensions.ToObservable<Result<A>>(TryAsyncExtensions.Try<A>(ma)), (Func<Result<A>, bool>)delegate(Result<A> ra)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				Result<A> val2 = ra;
				return val2.IsSuccess;
			}), (Func<Result<A>, A>)delegate(Result<A> ra)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				Result<A> val = ra;
				return val.IfFail(default(A));
			});
		}

		public unsafe static IObservable<B> MatchObservable<A, B>(this TryAsync<A> ma, Func<A, IObservable<B>> Succ, Func<Exception, B> Fail)
		{
			return Observable.SelectMany<Result<A>, B, B>(TaskObservableExtensions.ToObservable<Result<A>>(TryAsyncExtensions.Try<A>(ma)), (Func<Result<A>, IObservable<B>>)delegate(Result<A> ra)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				Result<A> val = ra;
				return ((Result<IObservable<B>>*)(&val))->Match<IObservable<B>>((Func<IObservable<B>, IObservable<B>>)(object)Succ, (Func<Exception, IObservable<B>>)((Exception e) => Observable.Return<B>(Fail(e))));
			}, (Func<Result<A>, B, B>)((Result<A> ra, B rb) => rb));
		}

		public unsafe static IObservable<R> MatchObservable<A, R>(this TryAsync<A> ma, Func<A, IObservable<R>> Succ, Func<Exception, IObservable<R>> Fail)
		{
			return Observable.SelectMany<Result<A>, R, R>(TaskObservableExtensions.ToObservable<Result<A>>(TryAsyncExtensions.Try<A>(ma)), (Func<Result<A>, IObservable<R>>)delegate(Result<A> ra)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				Result<A> val = ra;
				return ((Result<IObservable<R>>*)(&val))->Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)Succ, Fail);
			}, (Func<Result<A>, R, R>)((Result<A> ra, R rb) => rb));
		}

		public unsafe static IObservable<R> MatchObservable<A, R>(this TryAsync<A> ma, Func<A, R> Succ, Func<Exception, IObservable<R>> Fail)
		{
			return Observable.SelectMany<Result<A>, R, R>(TaskObservableExtensions.ToObservable<Result<A>>(TryAsyncExtensions.Try<A>(ma)), (Func<Result<A>, IObservable<R>>)delegate(Result<A> ra)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				Result<A> val = ra;
				return ((Result<IObservable<R>>*)(&val))->Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)(Func<A, IObservable<R>>)((A x) => Observable.Return<R>(Succ(x))), Fail);
			}, (Func<Result<A>, R, R>)((Result<A> ra, R rb) => rb));
		}
	}
	public static class TryOptionRxExtensions
	{
		public static IObservable<A> ToObservable<A>(this TryOption<A> ma)
		{
			return TryOptionExtensions.Match<A, IObservable<A>>(ma, (Func<A, IObservable<A>>)Observable.Return<A>, (Func<IObservable<A>>)(() => Observable.Empty<A>()), (Func<Exception, IObservable<A>>)((Exception e) => Observable.Empty<A>()));
		}

		public static IObservable<R> MatchObservable<A, R>(this TryOption<A> ma, Func<A, IObservable<R>> Some, Func<R> Fail)
		{
			return TryOptionExtensions.Match<A, IObservable<R>>(ma, Some, (Func<IObservable<R>>)(() => Observable.Return<R>(Fail())));
		}

		public static IObservable<R> MatchObservable<A, R>(this TryOption<A> ma, Func<A, IObservable<R>> Some, Func<R> None, Func<Exception, R> Fail)
		{
			return TryOptionExtensions.Match<A, IObservable<R>>(ma, Some, (Func<IObservable<R>>)(() => Observable.Return<R>(None())), (Func<Exception, IObservable<R>>)((Exception e) => Observable.Return<R>(Fail(e))));
		}

		public static IObservable<R> MatchObservable<A, R>(this TryOption<A> ma, Func<A, IObservable<R>> Some, Func<IObservable<R>> Fail)
		{
			return TryOptionExtensions.Match<A, IObservable<R>>(ma, Some, Fail);
		}

		public static IObservable<R> MatchObservable<A, R>(this TryOption<A> ma, Func<A, IObservable<R>> Some, Func<IObservable<R>> None, Func<Exception, IObservable<R>> Fail)
		{
			return TryOptionExtensions.Match<A, IObservable<R>>(ma, Some, None, Fail);
		}

		public static IObservable<R> MatchObservable<A, R>(this TryOption<A> ma, Func<A, R> Some, Func<IObservable<R>> Fail)
		{
			return TryOptionExtensions.Match<A, IObservable<R>>(ma, (Func<A, IObservable<R>>)((A x) => Observable.Return<R>(Some(x))), Fail);
		}

		public static IObservable<R> MatchObservable<A, R>(this TryOption<A> ma, Func<A, R> Some, Func<IObservable<R>> None, Func<Exception, IObservable<R>> Fail)
		{
			return TryOptionExtensions.Match<A, IObservable<R>>(ma, (Func<A, IObservable<R>>)((A x) => Observable.Return<R>(Some(x))), None, Fail);
		}

		public static IObservable<R> MatchObservable<T, R>(this IObservable<TryOption<T>> self, Func<T, R> Some, Func<R> Fail)
		{
			return Observable.Select<TryOption<T>, R>(self, (Func<TryOption<T>, R>)((TryOption<T> trySelf) => ((OptionalResult<R>)TryOptionExtensions.Try<T>(trySelf)).Match<R>((Func<R, R>)(object)Some, Fail, (Func<Exception, R>)((Exception _) => Fail()))));
		}

		public static IObservable<R> MatchObservable<T, R>(this IObservable<TryOption<T>> self, Func<T, IObservable<R>> Some, Func<R> Fail)
		{
			return Observable.Select<R, R>(Observable.SelectMany<TryOption<T>, R>(self, (Func<TryOption<T>, IObservable<R>>)((TryOption<T> trySelf) => ((OptionalResult<IObservable<R>>)TryOptionExtensions.Try<T>(trySelf)).Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)Some, (Func<IObservable<R>>)(() => Observable.Return<R>(Fail())), (Func<Exception, IObservable<R>>)((Exception _) => Observable.Return<R>(Fail()))))), (Func<R, R>)((R tt) => tt));
		}

		public static IObservable<R> MatchObservable<T, R>(this IObservable<TryOption<T>> self, Func<T, IObservable<R>> Some, Func<IObservable<R>> Fail)
		{
			return Observable.Select<R, R>(Observable.SelectMany<TryOption<T>, R>(self, (Func<TryOption<T>, IObservable<R>>)((TryOption<T> trySelf) => ((OptionalResult<IObservable<R>>)TryOptionExtensions.Try<T>(trySelf)).Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)Some, Fail, (Func<Exception, IObservable<R>>)((Exception _) => Fail())))), (Func<R, R>)((R tt) => tt));
		}

		public static IObservable<R> MatchObservable<T, R>(this IObservable<TryOption<T>> self, Func<T, R> Some, Func<IObservable<R>> Fail)
		{
			return Observable.Select<R, R>(Observable.SelectMany<TryOption<T>, R>(self, (Func<TryOption<T>, IObservable<R>>)((TryOption<T> trySelf) => ((OptionalResult<IObservable<R>>)TryOptionExtensions.Try<T>(trySelf)).Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)(Func<T, IObservable<R>>)((T x) => Observable.Return<R>(Some(x))), Fail, (Func<Exception, IObservable<R>>)((Exception _) => Fail())))), (Func<R, R>)((R tt) => tt));
		}

		public static IObservable<R> MatchObservable<T, R>(this IObservable<TryOption<T>> self, Func<T, R> Some, Func<R> None, Func<Exception, R> Fail)
		{
			return Observable.Select<TryOption<T>, R>(self, (Func<TryOption<T>, R>)((TryOption<T> trySelf) => ((OptionalResult<R>)TryOptionExtensions.Try<T>(trySelf)).Match<R>((Func<R, R>)(object)Some, None, Fail)));
		}

		public static IObservable<R> MatchObservable<T, R>(this IObservable<TryOption<T>> self, Func<T, IObservable<R>> Some, Func<R> None, Func<Exception, R> Fail)
		{
			return Observable.Select<R, R>(Observable.SelectMany<TryOption<T>, R>(self, (Func<TryOption<T>, IObservable<R>>)((TryOption<T> trySelf) => ((OptionalResult<IObservable<R>>)TryOptionExtensions.Try<T>(trySelf)).Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)Some, (Func<IObservable<R>>)(() => Observable.Return<R>(None())), (Func<Exception, IObservable<R>>)((Exception e) => Observable.Return<R>(Fail(e)))))), (Func<R, R>)((R tt) => tt));
		}

		public static IObservable<R> MatchObservable<T, R>(this IObservable<TryOption<T>> self, Func<T, IObservable<R>> Some, Func<IObservable<R>> None, Func<Exception, IObservable<R>> Fail)
		{
			return Observable.Select<R, R>(Observable.SelectMany<TryOption<T>, R>(self, (Func<TryOption<T>, IObservable<R>>)((TryOption<T> trySelf) => ((OptionalResult<IObservable<R>>)TryOptionExtensions.Try<T>(trySelf)).Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)Some, None, Fail))), (Func<R, R>)((R tt) => tt));
		}

		public static IObservable<R> MatchObservable<T, R>(this IObservable<TryOption<T>> self, Func<T, R> Some, Func<IObservable<R>> None, Func<Exception, IObservable<R>> Fail)
		{
			return Observable.Select<R, R>(Observable.SelectMany<TryOption<T>, R>(self, (Func<TryOption<T>, IObservable<R>>)((TryOption<T> trySelf) => ((OptionalResult<IObservable<R>>)TryOptionExtensions.Try<T>(trySelf)).Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)(Func<T, IObservable<R>>)((T x) => Observable.Return<R>(Some(x))), None, Fail))), (Func<R, R>)((R tt) => tt));
		}
	}
	public static class TryOptionAsyncRxExtensions
	{
		public static IObservable<A> ToObservable<A>(this TryOptionAsync<A> ma)
		{
			return Observable.Select<OptionalResult<A>, A>(Observable.Where<OptionalResult<A>>(TaskObservableExtensions.ToObservable<OptionalResult<A>>(TryOptionAsyncExtensions.Try<A>(ma)), (Func<OptionalResult<A>, bool>)delegate(OptionalResult<A> ra)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				OptionalResult<A> val2 = ra;
				return val2.IsSome;
			}), (Func<OptionalResult<A>, A>)delegate(OptionalResult<A> ra)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				OptionalResult<A> val = ra;
				return val.IfFailOrNone(default(A));
			});
		}

		public unsafe static IObservable<B> MatchObservable<A, B>(this TryOptionAsync<A> ma, Func<A, IObservable<B>> Some, Func<B> None, Func<Exception, B> Fail)
		{
			return Observable.SelectMany<OptionalResult<A>, B, B>(TaskObservableExtensions.ToObservable<OptionalResult<A>>(TryOptionAsyncExtensions.Try<A>(ma)), (Func<OptionalResult<A>, IObservable<B>>)delegate(OptionalResult<A> ra)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				OptionalResult<A> val = ra;
				return ((OptionalResult<IObservable<B>>*)(&val))->Match<IObservable<B>>((Func<IObservable<B>, IObservable<B>>)(object)Some, (Func<IObservable<B>>)(() => Observable.Return<B>(None())), (Func<Exception, IObservable<B>>)((Exception e) => Observable.Return<B>(Fail(e))));
			}, (Func<OptionalResult<A>, B, B>)((OptionalResult<A> ra, B rb) => rb));
		}

		public unsafe static IObservable<B> MatchObservable<A, B>(this TryOptionAsync<A> ma, Func<A, IObservable<B>> Some, Func<IObservable<B>> None, Func<Exception, B> Fail)
		{
			return Observable.SelectMany<OptionalResult<A>, B, B>(TaskObservableExtensions.ToObservable<OptionalResult<A>>(TryOptionAsyncExtensions.Try<A>(ma)), (Func<OptionalResult<A>, IObservable<B>>)delegate(OptionalResult<A> ra)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				OptionalResult<A> val = ra;
				return ((OptionalResult<IObservable<B>>*)(&val))->Match<IObservable<B>>((Func<IObservable<B>, IObservable<B>>)(object)Some, None, (Func<Exception, IObservable<B>>)((Exception e) => Observable.Return<B>(Fail(e))));
			}, (Func<OptionalResult<A>, B, B>)((OptionalResult<A> ra, B rb) => rb));
		}

		public unsafe static IObservable<R> MatchObservable<A, R>(this TryOptionAsync<A> ma, Func<A, IObservable<R>> Some, Func<R> None, Func<Exception, IObservable<R>> Fail)
		{
			return Observable.SelectMany<OptionalResult<A>, R, R>(TaskObservableExtensions.ToObservable<OptionalResult<A>>(TryOptionAsyncExtensions.Try<A>(ma)), (Func<OptionalResult<A>, IObservable<R>>)delegate(OptionalResult<A> ra)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				OptionalResult<A> val = ra;
				return ((OptionalResult<IObservable<R>>*)(&val))->Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)Some, (Func<IObservable<R>>)(() => Observable.Return<R>(None())), Fail);
			}, (Func<OptionalResult<A>, R, R>)((OptionalResult<A> ra, R rb) => rb));
		}

		public unsafe static IObservable<R> MatchObservable<A, R>(this TryOptionAsync<A> ma, Func<A, IObservable<R>> Some, Func<IObservable<R>> None, Func<Exception, IObservable<R>> Fail)
		{
			return Observable.SelectMany<OptionalResult<A>, R, R>(TaskObservableExtensions.ToObservable<OptionalResult<A>>(TryOptionAsyncExtensions.Try<A>(ma)), (Func<OptionalResult<A>, IObservable<R>>)delegate(OptionalResult<A> ra)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				OptionalResult<A> val = ra;
				return ((OptionalResult<IObservable<R>>*)(&val))->Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)Some, None, Fail);
			}, (Func<OptionalResult<A>, R, R>)((OptionalResult<A> ra, R rb) => rb));
		}

		public unsafe static IObservable<R> MatchObservable<A, R>(this TryOptionAsync<A> ma, Func<A, R> Some, Func<R> None, Func<Exception, IObservable<R>> Fail)
		{
			return Observable.SelectMany<OptionalResult<A>, R, R>(TaskObservableExtensions.ToObservable<OptionalResult<A>>(TryOptionAsyncExtensions.Try<A>(ma)), (Func<OptionalResult<A>, IObservable<R>>)delegate(OptionalResult<A> ra)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				OptionalResult<A> val = ra;
				return ((OptionalResult<IObservable<R>>*)(&val))->Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)(Func<A, IObservable<R>>)((A x) => Observable.Return<R>(Some(x))), (Func<IObservable<R>>)(() => Observable.Return<R>(None())), Fail);
			}, (Func<OptionalResult<A>, R, R>)((OptionalResult<A> ra, R rb) => rb));
		}

		public unsafe static IObservable<R> MatchObservable<A, R>(this TryOptionAsync<A> ma, Func<A, R> Some, Func<IObservable<R>> None, Func<Exception, IObservable<R>> Fail)
		{
			return Observable.SelectMany<OptionalResult<A>, R, R>(TaskObservableExtensions.ToObservable<OptionalResult<A>>(TryOptionAsyncExtensions.Try<A>(ma)), (Func<OptionalResult<A>, IObservable<R>>)delegate(OptionalResult<A> ra)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				OptionalResult<A> val = ra;
				return ((OptionalResult<IObservable<R>>*)(&val))->Match<IObservable<R>>((Func<IObservable<R>, IObservable<R>>)(object)(Func<A, IObservable<R>>)((A x) => Observable.Return<R>(Some(x))), None, Fail);
			}, (Func<OptionalResult<A>, R, R>)((OptionalResult<A> ra, R rb) => rb));
		}
	}
	public static class ValidationRxExtensions
	{
		[Pure]
		public unsafe static IObservable<R2> MatchObservable<MonoidFail, FAIL, SUCCESS, R2>(this Validation<MonoidFail, FAIL, SUCCESS> ma, Func<SUCCESS, IObservable<R2>> Succ, Func<FAIL, R2> Fail) where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>
		{
			return ((Validation<IObservable<R2>, ?, ?>*)(&ma))->Match<IObservable<R2>>((Func<?, IObservable<R2>>)(object)Succ, (Func<?, IObservable<R2>>)(object)(Func<FAIL, IObservable<R2>>)((FAIL x) => Observable.Return<R2>(Fail(x))));
		}

		[Pure]
		public unsafe static IObservable<R2> MatchObservable<MonoidFail, FAIL, SUCCESS, R2>(this Validation<MonoidFail, FAIL, SUCCESS> ma, Func<SUCCESS, IObservable<R2>> Succ, Func<FAIL, IObservable<R2>> Fail) where MonoidFail : struct, Monoid<FAIL>, Eq<FAIL>
		{
			return ((Validation<IObservable<R2>, ?, ?>*)(&ma))->Match<IObservable<R2>>((Func<?, IObservable<R2>>)(object)Succ, (Func<?, IObservable<R2>>)(object)Fail);
		}
	}
	public static class ValidationSeqRxExtensions
	{
		[Pure]
		public unsafe static IObservable<R2> MatchObservable<FAIL, SUCCESS, R2>(this Validation<FAIL, SUCCESS> ma, Func<SUCCESS, IObservable<R2>> Succ, Func<Seq<FAIL>, R2> Fail)
		{
			return ((Validation<IObservable<R2>, ?>*)(&ma))->Match<IObservable<R2>>((Func<?, IObservable<R2>>)(object)Succ, (Func<Seq<IObservable<R2>>, IObservable<R2>>)(object)(Func<Seq<FAIL>, IObservable<R2>>)((Seq<FAIL> x) => Observable.Return<R2>(Fail(x))));
		}

		[Pure]
		public unsafe static IObservable<R2> MatchObservable<FAIL, SUCCESS, R2>(this Validation<FAIL, SUCCESS> ma, Func<SUCCESS, IObservable<R2>> Succ, Func<Seq<FAIL>, IObservable<R2>> Fail)
		{
			return ((Validation<IObservable<R2>, ?>*)(&ma))->Match<IObservable<R2>>((Func<?, IObservable<R2>>)(object)Succ, (Func<Seq<IObservable<R2>>, IObservable<R2>>)(object)Fail);
		}
	}
}

BepInEx/plugins/LanguageExt/System.Threading.Tasks.Extensions.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Threading.Tasks;
using System.Threading.Tasks.Sources;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("System.Threading.Tasks.Extensions")]
[assembly: AssemblyDescription("System.Threading.Tasks.Extensions")]
[assembly: AssemblyDefaultAlias("System.Threading.Tasks.Extensions")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft® .NET Framework")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyFileVersion("4.6.28619.01")]
[assembly: AssemblyInformationalVersion("4.6.28619.01 @BuiltBy: dlab14-DDVSOWINAGE069 @Branch: release/2.1 @SrcCode: https://github.com/dotnet/corefx/tree/7601f4f6225089ffb291dc7d58293c7bbf5c5d4f")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyVersion("4.2.0.1")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowArgumentNullException(System.ExceptionArgument argument)
		{
			throw GetArgumentNullException(argument);
		}

		internal static void ThrowArgumentOutOfRangeException(System.ExceptionArgument argument)
		{
			throw GetArgumentOutOfRangeException(argument);
		}

		private static ArgumentNullException GetArgumentNullException(System.ExceptionArgument argument)
		{
			return new ArgumentNullException(GetArgumentName(argument));
		}

		private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(System.ExceptionArgument argument)
		{
			return new ArgumentOutOfRangeException(GetArgumentName(argument));
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static string GetArgumentName(System.ExceptionArgument argument)
		{
			return argument.ToString();
		}
	}
	internal enum ExceptionArgument
	{
		task,
		source,
		state
	}
}
namespace System.Threading.Tasks
{
	[StructLayout(LayoutKind.Auto)]
	[AsyncMethodBuilder(typeof(AsyncValueTaskMethodBuilder))]
	public readonly struct ValueTask : IEquatable<ValueTask>
	{
		private sealed class ValueTaskSourceAsTask : TaskCompletionSource<bool>
		{
			private static readonly Action<object> s_completionAction = delegate(object state)
			{
				IValueTaskSource source;
				if (!(state is ValueTaskSourceAsTask valueTaskSourceAsTask) || (source = valueTaskSourceAsTask._source) == null)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.state);
					return;
				}
				valueTaskSourceAsTask._source = null;
				ValueTaskSourceStatus status = source.GetStatus(valueTaskSourceAsTask._token);
				try
				{
					source.GetResult(valueTaskSourceAsTask._token);
					valueTaskSourceAsTask.TrySetResult(result: false);
				}
				catch (Exception exception)
				{
					if (status == ValueTaskSourceStatus.Canceled)
					{
						valueTaskSourceAsTask.TrySetCanceled();
					}
					else
					{
						valueTaskSourceAsTask.TrySetException(exception);
					}
				}
			};

			private IValueTaskSource _source;

			private readonly short _token;

			public ValueTaskSourceAsTask(IValueTaskSource source, short token)
			{
				_token = token;
				_source = source;
				source.OnCompleted(s_completionAction, this, token, ValueTaskSourceOnCompletedFlags.None);
			}
		}

		private static readonly Task s_canceledTask = Task.Delay(-1, new CancellationToken(canceled: true));

		internal readonly object _obj;

		internal readonly short _token;

		internal readonly bool _continueOnCapturedContext;

		internal static Task CompletedTask { get; } = Task.Delay(0);


		public bool IsCompleted
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return true;
				}
				if (obj is Task task)
				{
					return task.IsCompleted;
				}
				return Unsafe.As<IValueTaskSource>(obj).GetStatus(_token) != ValueTaskSourceStatus.Pending;
			}
		}

		public bool IsCompletedSuccessfully
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return true;
				}
				if (obj is Task task)
				{
					return task.Status == TaskStatus.RanToCompletion;
				}
				return Unsafe.As<IValueTaskSource>(obj).GetStatus(_token) == ValueTaskSourceStatus.Succeeded;
			}
		}

		public bool IsFaulted
		{
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return false;
				}
				if (obj is Task task)
				{
					return task.IsFaulted;
				}
				return Unsafe.As<IValueTaskSource>(obj).GetStatus(_token) == ValueTaskSourceStatus.Faulted;
			}
		}

		public bool IsCanceled
		{
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return false;
				}
				if (obj is Task task)
				{
					return task.IsCanceled;
				}
				return Unsafe.As<IValueTaskSource>(obj).GetStatus(_token) == ValueTaskSourceStatus.Canceled;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ValueTask(Task task)
		{
			if (task == null)
			{
				System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument.task);
			}
			_obj = task;
			_continueOnCapturedContext = true;
			_token = 0;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ValueTask(IValueTaskSource source, short token)
		{
			if (source == null)
			{
				System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument.source);
			}
			_obj = source;
			_token = token;
			_continueOnCapturedContext = true;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private ValueTask(object obj, short token, bool continueOnCapturedContext)
		{
			_obj = obj;
			_token = token;
			_continueOnCapturedContext = continueOnCapturedContext;
		}

		public override int GetHashCode()
		{
			return _obj?.GetHashCode() ?? 0;
		}

		public override bool Equals(object obj)
		{
			if (obj is ValueTask)
			{
				return Equals((ValueTask)obj);
			}
			return false;
		}

		public bool Equals(ValueTask other)
		{
			if (_obj == other._obj)
			{
				return _token == other._token;
			}
			return false;
		}

		public static bool operator ==(ValueTask left, ValueTask right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(ValueTask left, ValueTask right)
		{
			return !left.Equals(right);
		}

		public Task AsTask()
		{
			object obj = _obj;
			object obj2;
			if (obj != null)
			{
				obj2 = obj as Task;
				if (obj2 == null)
				{
					return GetTaskForValueTaskSource(Unsafe.As<IValueTaskSource>(obj));
				}
			}
			else
			{
				obj2 = CompletedTask;
			}
			return (Task)obj2;
		}

		public ValueTask Preserve()
		{
			if (_obj != null)
			{
				return new ValueTask(AsTask());
			}
			return this;
		}

		private Task GetTaskForValueTaskSource(IValueTaskSource t)
		{
			ValueTaskSourceStatus status = t.GetStatus(_token);
			if (status != 0)
			{
				try
				{
					t.GetResult(_token);
					return CompletedTask;
				}
				catch (Exception exception)
				{
					if (status == ValueTaskSourceStatus.Canceled)
					{
						return s_canceledTask;
					}
					TaskCompletionSource<bool> taskCompletionSource = new TaskCompletionSource<bool>();
					taskCompletionSource.TrySetException(exception);
					return taskCompletionSource.Task;
				}
			}
			ValueTaskSourceAsTask valueTaskSourceAsTask = new ValueTaskSourceAsTask(t, _token);
			return valueTaskSourceAsTask.Task;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[StackTraceHidden]
		internal void ThrowIfCompletedUnsuccessfully()
		{
			object obj = _obj;
			if (obj != null)
			{
				if (obj is Task task)
				{
					task.GetAwaiter().GetResult();
				}
				else
				{
					Unsafe.As<IValueTaskSource>(obj).GetResult(_token);
				}
			}
		}

		public ValueTaskAwaiter GetAwaiter()
		{
			return new ValueTaskAwaiter(this);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ConfiguredValueTaskAwaitable ConfigureAwait(bool continueOnCapturedContext)
		{
			return new ConfiguredValueTaskAwaitable(new ValueTask(_obj, _token, continueOnCapturedContext));
		}
	}
	[StructLayout(LayoutKind.Auto)]
	[AsyncMethodBuilder(typeof(AsyncValueTaskMethodBuilder<>))]
	public readonly struct ValueTask<TResult> : IEquatable<ValueTask<TResult>>
	{
		private sealed class ValueTaskSourceAsTask : TaskCompletionSource<TResult>
		{
			private static readonly Action<object> s_completionAction = delegate(object state)
			{
				IValueTaskSource<TResult> source;
				if (!(state is ValueTaskSourceAsTask valueTaskSourceAsTask) || (source = valueTaskSourceAsTask._source) == null)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.state);
					return;
				}
				valueTaskSourceAsTask._source = null;
				ValueTaskSourceStatus status = source.GetStatus(valueTaskSourceAsTask._token);
				try
				{
					valueTaskSourceAsTask.TrySetResult(source.GetResult(valueTaskSourceAsTask._token));
				}
				catch (Exception exception)
				{
					if (status == ValueTaskSourceStatus.Canceled)
					{
						valueTaskSourceAsTask.TrySetCanceled();
					}
					else
					{
						valueTaskSourceAsTask.TrySetException(exception);
					}
				}
			};

			private IValueTaskSource<TResult> _source;

			private readonly short _token;

			public ValueTaskSourceAsTask(IValueTaskSource<TResult> source, short token)
			{
				_source = source;
				_token = token;
				source.OnCompleted(s_completionAction, this, token, ValueTaskSourceOnCompletedFlags.None);
			}
		}

		private static Task<TResult> s_canceledTask;

		internal readonly object _obj;

		internal readonly TResult _result;

		internal readonly short _token;

		internal readonly bool _continueOnCapturedContext;

		public bool IsCompleted
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return true;
				}
				if (obj is Task<TResult> task)
				{
					return task.IsCompleted;
				}
				return Unsafe.As<IValueTaskSource<TResult>>(obj).GetStatus(_token) != ValueTaskSourceStatus.Pending;
			}
		}

		public bool IsCompletedSuccessfully
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return true;
				}
				if (obj is Task<TResult> task)
				{
					return task.Status == TaskStatus.RanToCompletion;
				}
				return Unsafe.As<IValueTaskSource<TResult>>(obj).GetStatus(_token) == ValueTaskSourceStatus.Succeeded;
			}
		}

		public bool IsFaulted
		{
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return false;
				}
				if (obj is Task<TResult> task)
				{
					return task.IsFaulted;
				}
				return Unsafe.As<IValueTaskSource<TResult>>(obj).GetStatus(_token) == ValueTaskSourceStatus.Faulted;
			}
		}

		public bool IsCanceled
		{
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return false;
				}
				if (obj is Task<TResult> task)
				{
					return task.IsCanceled;
				}
				return Unsafe.As<IValueTaskSource<TResult>>(obj).GetStatus(_token) == ValueTaskSourceStatus.Canceled;
			}
		}

		public TResult Result
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return _result;
				}
				if (obj is Task<TResult> task)
				{
					return task.GetAwaiter().GetResult();
				}
				return Unsafe.As<IValueTaskSource<TResult>>(obj).GetResult(_token);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ValueTask(TResult result)
		{
			_result = result;
			_obj = null;
			_continueOnCapturedContext = true;
			_token = 0;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ValueTask(Task<TResult> task)
		{
			if (task == null)
			{
				System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument.task);
			}
			_obj = task;
			_result = default(TResult);
			_continueOnCapturedContext = true;
			_token = 0;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ValueTask(IValueTaskSource<TResult> source, short token)
		{
			if (source == null)
			{
				System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument.source);
			}
			_obj = source;
			_token = token;
			_result = default(TResult);
			_continueOnCapturedContext = true;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private ValueTask(object obj, TResult result, short token, bool continueOnCapturedContext)
		{
			_obj = obj;
			_result = result;
			_token = token;
			_continueOnCapturedContext = continueOnCapturedContext;
		}

		public override int GetHashCode()
		{
			if (_obj == null)
			{
				if (_result == null)
				{
					return 0;
				}
				return _result.GetHashCode();
			}
			return _obj.GetHashCode();
		}

		public override bool Equals(object obj)
		{
			if (obj is ValueTask<TResult>)
			{
				return Equals((ValueTask<TResult>)obj);
			}
			return false;
		}

		public bool Equals(ValueTask<TResult> other)
		{
			if (_obj == null && other._obj == null)
			{
				return EqualityComparer<TResult>.Default.Equals(_result, other._result);
			}
			if (_obj == other._obj)
			{
				return _token == other._token;
			}
			return false;
		}

		public static bool operator ==(ValueTask<TResult> left, ValueTask<TResult> right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(ValueTask<TResult> left, ValueTask<TResult> right)
		{
			return !left.Equals(right);
		}

		public Task<TResult> AsTask()
		{
			object obj = _obj;
			if (obj == null)
			{
				return Task.FromResult(_result);
			}
			if (obj is Task<TResult> result)
			{
				return result;
			}
			return GetTaskForValueTaskSource(Unsafe.As<IValueTaskSource<TResult>>(obj));
		}

		public ValueTask<TResult> Preserve()
		{
			if (_obj != null)
			{
				return new ValueTask<TResult>(AsTask());
			}
			return this;
		}

		private Task<TResult> GetTaskForValueTaskSource(IValueTaskSource<TResult> t)
		{
			ValueTaskSourceStatus status = t.GetStatus(_token);
			if (status != 0)
			{
				try
				{
					return Task.FromResult(t.GetResult(_token));
				}
				catch (Exception exception)
				{
					if (status == ValueTaskSourceStatus.Canceled)
					{
						Task<TResult> task = s_canceledTask;
						if (task == null)
						{
							TaskCompletionSource<TResult> taskCompletionSource = new TaskCompletionSource<TResult>();
							taskCompletionSource.TrySetCanceled();
							task = (s_canceledTask = taskCompletionSource.Task);
						}
						return task;
					}
					TaskCompletionSource<TResult> taskCompletionSource2 = new TaskCompletionSource<TResult>();
					taskCompletionSource2.TrySetException(exception);
					return taskCompletionSource2.Task;
				}
			}
			ValueTaskSourceAsTask valueTaskSourceAsTask = new ValueTaskSourceAsTask(t, _token);
			return valueTaskSourceAsTask.Task;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ValueTaskAwaiter<TResult> GetAwaiter()
		{
			return new ValueTaskAwaiter<TResult>(this);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ConfiguredValueTaskAwaitable<TResult> ConfigureAwait(bool continueOnCapturedContext)
		{
			return new ConfiguredValueTaskAwaitable<TResult>(new ValueTask<TResult>(_obj, _result, _token, continueOnCapturedContext));
		}

		public override string ToString()
		{
			if (IsCompletedSuccessfully)
			{
				TResult result = Result;
				if (result != null)
				{
					return result.ToString();
				}
			}
			return string.Empty;
		}
	}
}
namespace System.Threading.Tasks.Sources
{
	[Flags]
	public enum ValueTaskSourceOnCompletedFlags
	{
		None = 0,
		UseSchedulingContext = 1,
		FlowExecutionContext = 2
	}
	public enum ValueTaskSourceStatus
	{
		Pending,
		Succeeded,
		Faulted,
		Canceled
	}
	public interface IValueTaskSource
	{
		ValueTaskSourceStatus GetStatus(short token);

		void OnCompleted(Action<object> continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags);

		void GetResult(short token);
	}
	public interface IValueTaskSource<out TResult>
	{
		ValueTaskSourceStatus GetStatus(short token);

		void OnCompleted(Action<object> continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags);

		TResult GetResult(short token);
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false, AllowMultiple = false)]
	public sealed class AsyncMethodBuilderAttribute : Attribute
	{
		public Type BuilderType { get; }

		public AsyncMethodBuilderAttribute(Type builderType)
		{
			BuilderType = builderType;
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public struct AsyncValueTaskMethodBuilder
	{
		private AsyncTaskMethodBuilder _methodBuilder;

		private bool _haveResult;

		private bool _useBuilder;

		public ValueTask Task
		{
			get
			{
				if (_haveResult)
				{
					return default(ValueTask);
				}
				_useBuilder = true;
				return new ValueTask(_methodBuilder.Task);
			}
		}

		public static AsyncValueTaskMethodBuilder Create()
		{
			return default(AsyncValueTaskMethodBuilder);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
		{
			_methodBuilder.Start(ref stateMachine);
		}

		public void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			_methodBuilder.SetStateMachine(stateMachine);
		}

		public void SetResult()
		{
			if (_useBuilder)
			{
				_methodBuilder.SetResult();
			}
			else
			{
				_haveResult = true;
			}
		}

		public void SetException(Exception exception)
		{
			_methodBuilder.SetException(exception);
		}

		public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
		{
			_useBuilder = true;
			_methodBuilder.AwaitOnCompleted(ref awaiter, ref stateMachine);
		}

		[SecuritySafeCritical]
		public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
		{
			_useBuilder = true;
			_methodBuilder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine);
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public struct AsyncValueTaskMethodBuilder<TResult>
	{
		private AsyncTaskMethodBuilder<TResult> _methodBuilder;

		private TResult _result;

		private bool _haveResult;

		private bool _useBuilder;

		public ValueTask<TResult> Task
		{
			get
			{
				if (_haveResult)
				{
					return new ValueTask<TResult>(_result);
				}
				_useBuilder = true;
				return new ValueTask<TResult>(_methodBuilder.Task);
			}
		}

		public static AsyncValueTaskMethodBuilder<TResult> Create()
		{
			return default(AsyncValueTaskMethodBuilder<TResult>);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
		{
			_methodBuilder.Start(ref stateMachine);
		}

		public void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			_methodBuilder.SetStateMachine(stateMachine);
		}

		public void SetResult(TResult result)
		{
			if (_useBuilder)
			{
				_methodBuilder.SetResult(result);
				return;
			}
			_result = result;
			_haveResult = true;
		}

		public void SetException(Exception exception)
		{
			_methodBuilder.SetException(exception);
		}

		public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
		{
			_useBuilder = true;
			_methodBuilder.AwaitOnCompleted(ref awaiter, ref stateMachine);
		}

		[SecuritySafeCritical]
		public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
		{
			_useBuilder = true;
			_methodBuilder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine);
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public readonly struct ConfiguredValueTaskAwaitable
	{
		[StructLayout(LayoutKind.Auto)]
		public readonly struct ConfiguredValueTaskAwaiter : ICriticalNotifyCompletion, INotifyCompletion
		{
			private readonly ValueTask _value;

			public bool IsCompleted
			{
				[MethodImpl(MethodImplOptions.AggressiveInlining)]
				get
				{
					return _value.IsCompleted;
				}
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			internal ConfiguredValueTaskAwaiter(ValueTask value)
			{
				_value = value;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			[StackTraceHidden]
			public void GetResult()
			{
				_value.ThrowIfCompletedUnsuccessfully();
			}

			public void OnCompleted(Action continuation)
			{
				object obj = _value._obj;
				if (obj is Task task)
				{
					task.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().OnCompleted(continuation);
				}
				else if (obj != null)
				{
					Unsafe.As<IValueTaskSource>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.FlowExecutionContext | (_value._continueOnCapturedContext ? ValueTaskSourceOnCompletedFlags.UseSchedulingContext : ValueTaskSourceOnCompletedFlags.None));
				}
				else
				{
					ValueTask.CompletedTask.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().OnCompleted(continuation);
				}
			}

			public void UnsafeOnCompleted(Action continuation)
			{
				object obj = _value._obj;
				if (obj is Task task)
				{
					task.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().UnsafeOnCompleted(continuation);
				}
				else if (obj != null)
				{
					Unsafe.As<IValueTaskSource>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, _value._continueOnCapturedContext ? ValueTaskSourceOnCompletedFlags.UseSchedulingContext : ValueTaskSourceOnCompletedFlags.None);
				}
				else
				{
					ValueTask.CompletedTask.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().UnsafeOnCompleted(continuation);
				}
			}
		}

		private readonly ValueTask _value;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal ConfiguredValueTaskAwaitable(ValueTask value)
		{
			_value = value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ConfiguredValueTaskAwaiter GetAwaiter()
		{
			return new ConfiguredValueTaskAwaiter(_value);
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public readonly struct ConfiguredValueTaskAwaitable<TResult>
	{
		[StructLayout(LayoutKind.Auto)]
		public readonly struct ConfiguredValueTaskAwaiter : ICriticalNotifyCompletion, INotifyCompletion
		{
			private readonly ValueTask<TResult> _value;

			public bool IsCompleted
			{
				[MethodImpl(MethodImplOptions.AggressiveInlining)]
				get
				{
					return _value.IsCompleted;
				}
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			internal ConfiguredValueTaskAwaiter(ValueTask<TResult> value)
			{
				_value = value;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			[StackTraceHidden]
			public TResult GetResult()
			{
				return _value.Result;
			}

			public void OnCompleted(Action continuation)
			{
				object obj = _value._obj;
				if (obj is Task<TResult> task)
				{
					task.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().OnCompleted(continuation);
				}
				else if (obj != null)
				{
					Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.FlowExecutionContext | (_value._continueOnCapturedContext ? ValueTaskSourceOnCompletedFlags.UseSchedulingContext : ValueTaskSourceOnCompletedFlags.None));
				}
				else
				{
					ValueTask.CompletedTask.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().OnCompleted(continuation);
				}
			}

			public void UnsafeOnCompleted(Action continuation)
			{
				object obj = _value._obj;
				if (obj is Task<TResult> task)
				{
					task.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().UnsafeOnCompleted(continuation);
				}
				else if (obj != null)
				{
					Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, _value._continueOnCapturedContext ? ValueTaskSourceOnCompletedFlags.UseSchedulingContext : ValueTaskSourceOnCompletedFlags.None);
				}
				else
				{
					ValueTask.CompletedTask.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().UnsafeOnCompleted(continuation);
				}
			}
		}

		private readonly ValueTask<TResult> _value;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal ConfiguredValueTaskAwaitable(ValueTask<TResult> value)
		{
			_value = value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ConfiguredValueTaskAwaiter GetAwaiter()
		{
			return new ConfiguredValueTaskAwaiter(_value);
		}
	}
	public readonly struct ValueTaskAwaiter : ICriticalNotifyCompletion, INotifyCompletion
	{
		internal static readonly Action<object> s_invokeActionDelegate = delegate(object state)
		{
			if (!(state is Action action))
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.state);
			}
			else
			{
				action();
			}
		};

		private readonly ValueTask _value;

		public bool IsCompleted
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				return _value.IsCompleted;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal ValueTaskAwaiter(ValueTask value)
		{
			_value = value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[StackTraceHidden]
		public void GetResult()
		{
			_value.ThrowIfCompletedUnsuccessfully();
		}

		public void OnCompleted(Action continuation)
		{
			object obj = _value._obj;
			if (obj is Task task)
			{
				task.GetAwaiter().OnCompleted(continuation);
			}
			else if (obj != null)
			{
				Unsafe.As<IValueTaskSource>(obj).OnCompleted(s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext | ValueTaskSourceOnCompletedFlags.FlowExecutionContext);
			}
			else
			{
				ValueTask.CompletedTask.GetAwaiter().OnCompleted(continuation);
			}
		}

		public void UnsafeOnCompleted(Action continuation)
		{
			object obj = _value._obj;
			if (obj is Task task)
			{
				task.GetAwaiter().UnsafeOnCompleted(continuation);
			}
			else if (obj != null)
			{
				Unsafe.As<IValueTaskSource>(obj).OnCompleted(s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext);
			}
			else
			{
				ValueTask.CompletedTask.GetAwaiter().UnsafeOnCompleted(continuation);
			}
		}
	}
	public readonly struct ValueTaskAwaiter<TResult> : ICriticalNotifyCompletion, INotifyCompletion
	{
		private readonly ValueTask<TResult> _value;

		public bool IsCompleted
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				return _value.IsCompleted;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal ValueTaskAwaiter(ValueTask<TResult> value)
		{
			_value = value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[StackTraceHidden]
		public TResult GetResult()
		{
			return _value.Result;
		}

		public void OnCompleted(Action continuation)
		{
			object obj = _value._obj;
			if (obj is Task<TResult> task)
			{
				task.GetAwaiter().OnCompleted(continuation);
			}
			else if (obj != null)
			{
				Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext | ValueTaskSourceOnCompletedFlags.FlowExecutionContext);
			}
			else
			{
				ValueTask.CompletedTask.GetAwaiter().OnCompleted(continuation);
			}
		}

		public void UnsafeOnCompleted(Action continuation)
		{
			object obj = _value._obj;
			if (obj is Task<TResult> task)
			{
				task.GetAwaiter().UnsafeOnCompleted(continuation);
			}
			else if (obj != null)
			{
				Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext);
			}
			else
			{
				ValueTask.CompletedTask.GetAwaiter().UnsafeOnCompleted(continuation);
			}
		}
	}
	[AttributeUsage(AttributeTargets.All)]
	internal class __BlockReflectionAttribute : Attribute
	{
	}
}
namespace System.Diagnostics
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class StackTraceHiddenAttribute : Attribute
	{
	}
}

BepInEx/plugins/LanguageExt/Microsoft.Bcl.AsyncInterfaces.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Bcl.AsyncInterfaces")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Provides the IAsyncEnumerable<T> and IAsyncDisposable interfaces and helper types for .NET Standard 2.0. This package is not required starting with .NET Standard 2.1 and .NET Core 3.0.\r\n\r\nCommonly Used Types:\r\nSystem.IAsyncDisposable\r\nSystem.Collections.Generic.IAsyncEnumerable\r\nSystem.Collections.Generic.IAsyncEnumerator")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Bcl.AsyncInterfaces")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace System
{
	public interface IAsyncDisposable
	{
		ValueTask DisposeAsync();
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Collections.Generic
{
	public interface IAsyncEnumerable<out T>
	{
		IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default(CancellationToken));
	}
	public interface IAsyncEnumerator<out T> : IAsyncDisposable
	{
		T Current { get; }

		ValueTask<bool> MoveNextAsync();
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[StructLayout(LayoutKind.Auto)]
	public struct AsyncIteratorMethodBuilder
	{
		private AsyncTaskMethodBuilder _methodBuilder;

		private object _id;

		internal object ObjectIdForDebugger => _id ?? Interlocked.CompareExchange(ref _id, new object(), null) ?? _id;

		public static AsyncIteratorMethodBuilder Create()
		{
			AsyncIteratorMethodBuilder result = default(AsyncIteratorMethodBuilder);
			result._methodBuilder = AsyncTaskMethodBuilder.Create();
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void MoveNext<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
		{
			_methodBuilder.Start(ref stateMachine);
		}

		public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
		{
			_methodBuilder.AwaitOnCompleted(ref awaiter, ref stateMachine);
		}

		public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
		{
			_methodBuilder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine);
		}

		public void Complete()
		{
			_methodBuilder.SetResult();
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
	public sealed class AsyncIteratorStateMachineAttribute : StateMachineAttribute
	{
		public AsyncIteratorStateMachineAttribute(Type stateMachineType)
			: base(stateMachineType)
		{
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public readonly struct ConfiguredAsyncDisposable
	{
		private readonly IAsyncDisposable _source;

		private readonly bool _continueOnCapturedContext;

		internal ConfiguredAsyncDisposable(IAsyncDisposable source, bool continueOnCapturedContext)
		{
			_source = source;
			_continueOnCapturedContext = continueOnCapturedContext;
		}

		public ConfiguredValueTaskAwaitable DisposeAsync()
		{
			return _source.DisposeAsync().ConfigureAwait(_continueOnCapturedContext);
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public readonly struct ConfiguredCancelableAsyncEnumerable<T>
	{
		[StructLayout(LayoutKind.Auto)]
		public readonly struct Enumerator
		{
			private readonly IAsyncEnumerator<T> _enumerator;

			private readonly bool _continueOnCapturedContext;

			public T Current => _enumerator.Current;

			internal Enumerator(IAsyncEnumerator<T> enumerator, bool continueOnCapturedContext)
			{
				_enumerator = enumerator;
				_continueOnCapturedContext = continueOnCapturedContext;
			}

			public ConfiguredValueTaskAwaitable<bool> MoveNextAsync()
			{
				return _enumerator.MoveNextAsync().ConfigureAwait(_continueOnCapturedContext);
			}

			public ConfiguredValueTaskAwaitable DisposeAsync()
			{
				return _enumerator.DisposeAsync().ConfigureAwait(_continueOnCapturedContext);
			}
		}

		private readonly IAsyncEnumerable<T> _enumerable;

		private readonly CancellationToken _cancellationToken;

		private readonly bool _continueOnCapturedContext;

		internal ConfiguredCancelableAsyncEnumerable(IAsyncEnumerable<T> enumerable, bool continueOnCapturedContext, CancellationToken cancellationToken)
		{
			_enumerable = enumerable;
			_continueOnCapturedContext = continueOnCapturedContext;
			_cancellationToken = cancellationToken;
		}

		public ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait(bool continueOnCapturedContext)
		{
			return new ConfiguredCancelableAsyncEnumerable<T>(_enumerable, continueOnCapturedContext, _cancellationToken);
		}

		public ConfiguredCancelableAsyncEnumerable<T> WithCancellation(CancellationToken cancellationToken)
		{
			return new ConfiguredCancelableAsyncEnumerable<T>(_enumerable, _continueOnCapturedContext, cancellationToken);
		}

		public Enumerator GetAsyncEnumerator()
		{
			return new Enumerator(_enumerable.GetAsyncEnumerator(_cancellationToken), _continueOnCapturedContext);
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	public sealed class EnumeratorCancellationAttribute : Attribute
	{
	}
}
namespace System.Threading.Tasks
{
	public static class TaskAsyncEnumerableExtensions
	{
		public static ConfiguredAsyncDisposable ConfigureAwait(this IAsyncDisposable source, bool continueOnCapturedContext)
		{
			return new ConfiguredAsyncDisposable(source, continueOnCapturedContext);
		}

		public static ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait<T>(this IAsyncEnumerable<T> source, bool continueOnCapturedContext)
		{
			return new ConfiguredCancelableAsyncEnumerable<T>(source, continueOnCapturedContext, default(CancellationToken));
		}

		public static ConfiguredCancelableAsyncEnumerable<T> WithCancellation<T>(this IAsyncEnumerable<T> source, CancellationToken cancellationToken)
		{
			return new ConfiguredCancelableAsyncEnumerable<T>(source, continueOnCapturedContext: true, cancellationToken);
		}
	}
}
namespace System.Threading.Tasks.Sources
{
	[StructLayout(LayoutKind.Auto)]
	public struct ManualResetValueTaskSourceCore<TResult>
	{
		private Action<object> _continuation;

		private object _continuationState;

		private ExecutionContext _executionContext;

		private object _capturedContext;

		private bool _completed;

		private TResult _result;

		private ExceptionDispatchInfo _error;

		private short _version;

		public bool RunContinuationsAsynchronously { get; set; }

		public short Version => _version;

		public void Reset()
		{
			_version++;
			_completed = false;
			_result = default(TResult);
			_error = null;
			_executionContext = null;
			_capturedContext = null;
			_continuation = null;
			_continuationState = null;
		}

		public void SetResult(TResult result)
		{
			_result = result;
			SignalCompletion();
		}

		public void SetException(Exception error)
		{
			_error = ExceptionDispatchInfo.Capture(error);
			SignalCompletion();
		}

		public ValueTaskSourceStatus GetStatus(short token)
		{
			ValidateToken(token);
			if (_continuation != null && _completed)
			{
				if (_error != null)
				{
					if (!(_error.SourceException is OperationCanceledException))
					{
						return ValueTaskSourceStatus.Faulted;
					}
					return ValueTaskSourceStatus.Canceled;
				}
				return ValueTaskSourceStatus.Succeeded;
			}
			return ValueTaskSourceStatus.Pending;
		}

		public TResult GetResult(short token)
		{
			ValidateToken(token);
			if (!_completed)
			{
				throw new InvalidOperationException();
			}
			_error?.Throw();
			return _result;
		}

		public void OnCompleted(Action<object?> continuation, object? state, short token, ValueTaskSourceOnCompletedFlags flags)
		{
			if (continuation == null)
			{
				throw new ArgumentNullException("continuation");
			}
			ValidateToken(token);
			if ((flags & ValueTaskSourceOnCompletedFlags.FlowExecutionContext) != 0)
			{
				_executionContext = ExecutionContext.Capture();
			}
			if ((flags & ValueTaskSourceOnCompletedFlags.UseSchedulingContext) != 0)
			{
				SynchronizationContext current = SynchronizationContext.Current;
				if (current != null && current.GetType() != typeof(SynchronizationContext))
				{
					_capturedContext = current;
				}
				else
				{
					TaskScheduler current2 = TaskScheduler.Current;
					if (current2 != TaskScheduler.Default)
					{
						_capturedContext = current2;
					}
				}
			}
			object obj = _continuation;
			if (obj == null)
			{
				_continuationState = state;
				obj = Interlocked.CompareExchange(ref _continuation, continuation, null);
			}
			if (obj == null)
			{
				return;
			}
			if (obj != System.Threading.Tasks.Sources.ManualResetValueTaskSourceCoreShared.s_sentinel)
			{
				throw new InvalidOperationException();
			}
			object capturedContext = _capturedContext;
			if (capturedContext != null)
			{
				if (!(capturedContext is SynchronizationContext synchronizationContext))
				{
					if (capturedContext is TaskScheduler scheduler)
					{
						Task.Factory.StartNew(continuation, state, CancellationToken.None, TaskCreationOptions.DenyChildAttach, scheduler);
					}
				}
				else
				{
					synchronizationContext.Post(delegate(object s)
					{
						Tuple<Action<object>, object> tuple = (Tuple<Action<object>, object>)s;
						tuple.Item1(tuple.Item2);
					}, Tuple.Create(continuation, state));
				}
			}
			else
			{
				Task.Factory.StartNew(continuation, state, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
			}
		}

		private void ValidateToken(short token)
		{
			if (token != _version)
			{
				throw new InvalidOperationException();
			}
		}

		private void SignalCompletion()
		{
			if (_completed)
			{
				throw new InvalidOperationException();
			}
			_completed = true;
			if (_continuation == null && Interlocked.CompareExchange(ref _continuation, System.Threading.Tasks.Sources.ManualResetValueTaskSourceCoreShared.s_sentinel, null) == null)
			{
				return;
			}
			if (_executionContext != null)
			{
				ExecutionContext.Run(_executionContext, delegate(object s)
				{
					((ManualResetValueTaskSourceCore<TResult>)s).InvokeContinuation();
				}, this);
			}
			else
			{
				InvokeContinuation();
			}
		}

		private void InvokeContinuation()
		{
			object capturedContext = _capturedContext;
			if (capturedContext != null)
			{
				if (!(capturedContext is SynchronizationContext synchronizationContext))
				{
					if (capturedContext is TaskScheduler scheduler)
					{
						Task.Factory.StartNew(_continuation, _continuationState, CancellationToken.None, TaskCreationOptions.DenyChildAttach, scheduler);
					}
				}
				else
				{
					synchronizationContext.Post(delegate(object s)
					{
						Tuple<Action<object>, object> tuple = (Tuple<Action<object>, object>)s;
						tuple.Item1(tuple.Item2);
					}, Tuple.Create(_continuation, _continuationState));
				}
			}
			else if (RunContinuationsAsynchronously)
			{
				Task.Factory.StartNew(_continuation, _continuationState, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
			}
			else
			{
				_continuation(_continuationState);
			}
		}
	}
	internal static class ManualResetValueTaskSourceCoreShared
	{
		internal static readonly Action<object> s_sentinel = CompletionSentinel;

		private static void CompletionSentinel(object _)
		{
			throw new InvalidOperationException();
		}
	}
}