
arrow.generic.coproduct13.Coproduct13.kt Maven / Gradle / Ivy
package arrow.generic.coproduct13
import arrow.core.Option
import arrow.core.toOption
import kotlin.Suppress
import kotlin.Unit
/**
* Represents a sealed hierarchy of 13 types where only one of the types is actually present.
*/
sealed class Coproduct13
/**
* Represents the first type of a Coproduct13
*/
data class First(val a: A) : Coproduct13()
/**
* Represents the second type of a Coproduct13
*/
data class Second(val b: B) : Coproduct13()
/**
* Represents the third type of a Coproduct13
*/
data class Third(val c: C) : Coproduct13()
/**
* Represents the fourth type of a Coproduct13
*/
data class Fourth(val d: D) : Coproduct13()
/**
* Represents the fifth type of a Coproduct13
*/
data class Fifth(val e: E) : Coproduct13()
/**
* Represents the sixth type of a Coproduct13
*/
data class Sixth(val f: F) : Coproduct13()
/**
* Represents the seventh type of a Coproduct13
*/
data class Seventh(val g: G) : Coproduct13()
/**
* Represents the eighth type of a Coproduct13
*/
data class Eighth(val h: H) : Coproduct13()
/**
* Represents the ninth type of a Coproduct13
*/
data class Ninth(val i: I) : Coproduct13()
/**
* Represents the tenth type of a Coproduct13
*/
data class Tenth(val j: J) : Coproduct13()
/**
* Represents the eleventh type of a Coproduct13
*/
data class Eleventh(val k: K) : Coproduct13()
/**
* Represents the twelfth type of a Coproduct13
*/
data class Twelfth(val l: L) : Coproduct13()
/**
* Represents the thirteenth type of a Coproduct13
*/
data class Thirteenth(val m: M) : Coproduct13()
/**
* Creates a Coproduct from the A type
*
* @return A Coproduct13 where the receiver is the A
*/
fun A.first(): Coproduct13 = First(this)
/**
* Creates a Coproduct from the B type
*
* @return A Coproduct13 where the receiver is the B
*/
fun B.second(): Coproduct13 = Second(this)
/**
* Creates a Coproduct from the C type
*
* @return A Coproduct13 where the receiver is the C
*/
fun C.third(): Coproduct13 = Third(this)
/**
* Creates a Coproduct from the D type
*
* @return A Coproduct13 where the receiver is the D
*/
fun D.fourth(): Coproduct13 = Fourth(this)
/**
* Creates a Coproduct from the E type
*
* @return A Coproduct13 where the receiver is the E
*/
fun E.fifth(): Coproduct13 = Fifth(this)
/**
* Creates a Coproduct from the F type
*
* @return A Coproduct13 where the receiver is the F
*/
fun F.sixth(): Coproduct13 = Sixth(this)
/**
* Creates a Coproduct from the G type
*
* @return A Coproduct13 where the receiver is the G
*/
fun G.seventh(): Coproduct13 = Seventh(this)
/**
* Creates a Coproduct from the H type
*
* @return A Coproduct13 where the receiver is the H
*/
fun H.eighth(): Coproduct13 = Eighth(this)
/**
* Creates a Coproduct from the I type
*
* @return A Coproduct13 where the receiver is the I
*/
fun I.ninth(): Coproduct13 = Ninth(this)
/**
* Creates a Coproduct from the J type
*
* @return A Coproduct13 where the receiver is the J
*/
fun J.tenth(): Coproduct13 = Tenth(this)
/**
* Creates a Coproduct from the K type
*
* @return A Coproduct13 where the receiver is the K
*/
fun K.eleventh(): Coproduct13 = Eleventh(this)
/**
* Creates a Coproduct from the L type
*
* @return A Coproduct13 where the receiver is the L
*/
fun L.twelfth(): Coproduct13 = Twelfth(this)
/**
* Creates a Coproduct from the M type
*
* @return A Coproduct13 where the receiver is the M
*/
fun M.thirteenth(): Coproduct13 = Thirteenth(this)
/**
* Transforms the Coproduct into an Option based on the actual value of the Coproduct
*
* @return None if the Coproduct was not the specified type, Some if it was the specified type
*/
fun Coproduct13.select(): Option = (this as?
First)?.a.toOption()
/**
* Transforms the Coproduct into an Option based on the actual value of the Coproduct
*
* @return None if the Coproduct was not the specified type, Some if it was the specified type
*/
@Suppress("UNUSED_PARAMETER")
fun Coproduct13<*, B, *, *, *, *, *, *, *, *, *, *, *>.select(dummy0: Unit = Unit): Option =
(this as? Second)?.b.toOption()
/**
* Transforms the Coproduct into an Option based on the actual value of the Coproduct
*
* @return None if the Coproduct was not the specified type, Some if it was the specified type
*/
@Suppress("UNUSED_PARAMETER")
fun Coproduct13<*, *, C, *, *, *, *, *, *, *, *, *, *>.select(dummy0: Unit = Unit, dummy1: Unit
= Unit): Option = (this as? Third)?.c.toOption()
/**
* Transforms the Coproduct into an Option based on the actual value of the Coproduct
*
* @return None if the Coproduct was not the specified type, Some if it was the specified type
*/
@Suppress("UNUSED_PARAMETER")
fun Coproduct13<*, *, *, D, *, *, *, *, *, *, *, *, *>.select(
dummy0: Unit = Unit,
dummy1: Unit = Unit,
dummy2: Unit = Unit
): Option = (this as? Fourth)?.d.toOption()
/**
* Transforms the Coproduct into an Option based on the actual value of the Coproduct
*
* @return None if the Coproduct was not the specified type, Some if it was the specified type
*/
@Suppress("UNUSED_PARAMETER")
fun Coproduct13<*, *, *, *, E, *, *, *, *, *, *, *, *>.select(
dummy0: Unit = Unit,
dummy1: Unit = Unit,
dummy2: Unit = Unit,
dummy3: Unit = Unit
): Option = (this as? Fifth)?.e.toOption()
/**
* Transforms the Coproduct into an Option based on the actual value of the Coproduct
*
* @return None if the Coproduct was not the specified type, Some if it was the specified type
*/
@Suppress("UNUSED_PARAMETER")
fun Coproduct13<*, *, *, *, *, F, *, *, *, *, *, *, *>.select(
dummy0: Unit = Unit,
dummy1: Unit = Unit,
dummy2: Unit = Unit,
dummy3: Unit = Unit,
dummy4: Unit = Unit
): Option = (this as? Sixth)?.f.toOption()
/**
* Transforms the Coproduct into an Option based on the actual value of the Coproduct
*
* @return None if the Coproduct was not the specified type, Some if it was the specified type
*/
@Suppress("UNUSED_PARAMETER")
fun Coproduct13<*, *, *, *, *, *, G, *, *, *, *, *, *>.select(
dummy0: Unit = Unit,
dummy1: Unit = Unit,
dummy2: Unit = Unit,
dummy3: Unit = Unit,
dummy4: Unit = Unit,
dummy5: Unit = Unit
): Option = (this as? Seventh)?.g.toOption()
/**
* Transforms the Coproduct into an Option based on the actual value of the Coproduct
*
* @return None if the Coproduct was not the specified type, Some if it was the specified type
*/
@Suppress("UNUSED_PARAMETER")
fun Coproduct13<*, *, *, *, *, *, *, H, *, *, *, *, *>.select(
dummy0: Unit = Unit,
dummy1: Unit = Unit,
dummy2: Unit = Unit,
dummy3: Unit = Unit,
dummy4: Unit = Unit,
dummy5: Unit = Unit,
dummy6: Unit = Unit
): Option = (this as? Eighth)?.h.toOption()
/**
* Transforms the Coproduct into an Option based on the actual value of the Coproduct
*
* @return None if the Coproduct was not the specified type, Some if it was the specified type
*/
@Suppress("UNUSED_PARAMETER")
fun Coproduct13<*, *, *, *, *, *, *, *, I, *, *, *, *>.select(
dummy0: Unit = Unit,
dummy1: Unit = Unit,
dummy2: Unit = Unit,
dummy3: Unit = Unit,
dummy4: Unit = Unit,
dummy5: Unit = Unit,
dummy6: Unit = Unit,
dummy7: Unit = Unit
): Option = (this as? Ninth)?.i.toOption()
/**
* Transforms the Coproduct into an Option based on the actual value of the Coproduct
*
* @return None if the Coproduct was not the specified type, Some if it was the specified type
*/
@Suppress("UNUSED_PARAMETER")
fun Coproduct13<*, *, *, *, *, *, *, *, *, J, *, *, *>.select(
dummy0: Unit = Unit,
dummy1: Unit = Unit,
dummy2: Unit = Unit,
dummy3: Unit = Unit,
dummy4: Unit = Unit,
dummy5: Unit = Unit,
dummy6: Unit = Unit,
dummy7: Unit = Unit,
dummy8: Unit = Unit
): Option = (this as? Tenth)?.j.toOption()
/**
* Transforms the Coproduct into an Option based on the actual value of the Coproduct
*
* @return None if the Coproduct was not the specified type, Some if it was the specified type
*/
@Suppress("UNUSED_PARAMETER")
fun Coproduct13<*, *, *, *, *, *, *, *, *, *, K, *, *>.select(
dummy0: Unit = Unit,
dummy1: Unit = Unit,
dummy2: Unit = Unit,
dummy3: Unit = Unit,
dummy4: Unit = Unit,
dummy5: Unit = Unit,
dummy6: Unit = Unit,
dummy7: Unit = Unit,
dummy8: Unit = Unit,
dummy9: Unit = Unit
): Option = (this as? Eleventh)?.k.toOption()
/**
* Transforms the Coproduct into an Option based on the actual value of the Coproduct
*
* @return None if the Coproduct was not the specified type, Some if it was the specified type
*/
@Suppress("UNUSED_PARAMETER")
fun Coproduct13<*, *, *, *, *, *, *, *, *, *, *, L, *>.select(
dummy0: Unit = Unit,
dummy1: Unit = Unit,
dummy2: Unit = Unit,
dummy3: Unit = Unit,
dummy4: Unit = Unit,
dummy5: Unit = Unit,
dummy6: Unit = Unit,
dummy7: Unit = Unit,
dummy8: Unit = Unit,
dummy9: Unit = Unit,
dummy10: Unit = Unit
): Option = (this as? Twelfth)?.l.toOption()
/**
* Transforms the Coproduct into an Option based on the actual value of the Coproduct
*
* @return None if the Coproduct was not the specified type, Some if it was the specified type
*/
@Suppress("UNUSED_PARAMETER")
fun Coproduct13<*, *, *, *, *, *, *, *, *, *, *, *, M>.select(
dummy0: Unit = Unit,
dummy1: Unit = Unit,
dummy2: Unit = Unit,
dummy3: Unit = Unit,
dummy4: Unit = Unit,
dummy5: Unit = Unit,
dummy6: Unit = Unit,
dummy7: Unit = Unit,
dummy8: Unit = Unit,
dummy9: Unit = Unit,
dummy10: Unit = Unit,
dummy11: Unit = Unit
): Option = (this as? Thirteenth)?.m.toOption()
/**
* Runs the function related to the actual value of the Coproduct and returns the result
*
* @param a The function used to map A to the RESULT type
* @param b The function used to map B to the RESULT type
* @param c The function used to map C to the RESULT type
* @param d The function used to map D to the RESULT type
* @param e The function used to map E to the RESULT type
* @param f The function used to map F to the RESULT type
* @param g The function used to map G to the RESULT type
* @param h The function used to map H to the RESULT type
* @param i The function used to map I to the RESULT type
* @param j The function used to map J to the RESULT type
* @param k The function used to map K to the RESULT type
* @param l The function used to map L to the RESULT type
* @param m The function used to map M to the RESULT type
*
* @return RESULT generated by one of the input functions
*/
fun Coproduct13.fold(
a: (A) -> RESULT,
b: (B) -> RESULT,
c: (C) -> RESULT,
d: (D) -> RESULT,
e: (E) -> RESULT,
f: (F) -> RESULT,
g: (G) -> RESULT,
h: (H) -> RESULT,
i: (I) -> RESULT,
j: (J) -> RESULT,
k: (K) -> RESULT,
l: (L) -> RESULT,
m: (M) -> RESULT
): RESULT = when (this) {
is First -> a(this.a)
is Second -> b(this.b)
is Third -> c(this.c)
is Fourth -> d(this.d)
is Fifth -> e(this.e)
is Sixth -> f(this.f)
is Seventh -> g(this.g)
is Eighth -> h(this.h)
is Ninth -> i(this.i)
is Tenth -> j(this.j)
is Eleventh -> k(this.k)
is Twelfth -> l(this.l)
is Thirteenth -> m(this.m)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy