All Downloads are FREE. Search and download functionalities are using the official Maven repository.

arrow.generic.coproduct21.Coproduct21.kt Maven / Gradle / Ivy

package arrow.generic.coproduct21

import arrow.core.Option
import arrow.core.toOption
import kotlin.Suppress
import kotlin.Unit

/**
 * Represents a sealed hierarchy of 21 types where only one of the types is actually present.
 */
sealed class Coproduct21

/**
 * Represents the first type of a Coproduct21
 */
data class First(val a: A) :
        Coproduct21()

/**
 * Represents the second type of a Coproduct21
 */
data class Second(val b: B) :
        Coproduct21()

/**
 * Represents the third type of a Coproduct21
 */
data class Third(val c: C) :
        Coproduct21()

/**
 * Represents the fourth type of a Coproduct21
 */
data class Fourth(val d: D) :
        Coproduct21()

/**
 * Represents the fifth type of a Coproduct21
 */
data class Fifth(val e: E) :
        Coproduct21()

/**
 * Represents the sixth type of a Coproduct21
 */
data class Sixth(val f: F) :
        Coproduct21()

/**
 * Represents the seventh type of a Coproduct21
 */
data class Seventh(val g: G) :
        Coproduct21()

/**
 * Represents the eighth type of a Coproduct21
 */
data class Eighth(val h: H) :
        Coproduct21()

/**
 * Represents the ninth type of a Coproduct21
 */
data class Ninth(val i: I) :
        Coproduct21()

/**
 * Represents the tenth type of a Coproduct21
 */
data class Tenth(val j: J) :
        Coproduct21()

/**
 * Represents the eleventh type of a Coproduct21
 */
data class Eleventh(val k: K) :
        Coproduct21()

/**
 * Represents the twelfth type of a Coproduct21
 */
data class Twelfth(val l: L) :
        Coproduct21()

/**
 * Represents the thirteenth type of a Coproduct21
 */
data class Thirteenth(val m: M) :
        Coproduct21()

/**
 * Represents the fourteenth type of a Coproduct21
 */
data class Fourteenth(val n: N) :
        Coproduct21()

/**
 * Represents the fifteenth type of a Coproduct21
 */
data class Fifteenth(val o: O) :
        Coproduct21()

/**
 * Represents the sixteenth type of a Coproduct21
 */
data class Sixteenth(val p: P) :
        Coproduct21()

/**
 * Represents the seventeenth type of a Coproduct21
 */
data class Seventeenth(val q: Q) :
        Coproduct21()

/**
 * Represents the eighteenth type of a Coproduct21
 */
data class Eighteenth(val r: R) :
        Coproduct21()

/**
 * Represents the nineteenth type of a Coproduct21
 */
data class Nineteenth(val s: S) :
        Coproduct21()

/**
 * Represents the twentieth type of a Coproduct21
 */
data class Twentieth(val t: T) :
        Coproduct21()

/**
 * Represents the twentyfirst type of a Coproduct21
 */
data class TwentyFirst(val u: U) :
        Coproduct21()

/**
 * Creates a Coproduct from the A type
 *
 * @return A Coproduct21 where the
 * receiver is the A
 */
fun  A.first(): Coproduct21 = First(this)

/**
 * Creates a Coproduct from the B type
 *
 * @return A Coproduct21 where the
 * receiver is the B
 */
fun  B.second(): Coproduct21 = Second(this)

/**
 * Creates a Coproduct from the C type
 *
 * @return A Coproduct21 where the
 * receiver is the C
 */
fun  C.third(): Coproduct21 = Third(this)

/**
 * Creates a Coproduct from the D type
 *
 * @return A Coproduct21 where the
 * receiver is the D
 */
fun  D.fourth(): Coproduct21 = Fourth(this)

/**
 * Creates a Coproduct from the E type
 *
 * @return A Coproduct21 where the
 * receiver is the E
 */
fun  E.fifth(): Coproduct21 = Fifth(this)

/**
 * Creates a Coproduct from the F type
 *
 * @return A Coproduct21 where the
 * receiver is the F
 */
fun  F.sixth(): Coproduct21 = Sixth(this)

/**
 * Creates a Coproduct from the G type
 *
 * @return A Coproduct21 where the
 * receiver is the G
 */
fun  G.seventh(): Coproduct21 = Seventh(this)

/**
 * Creates a Coproduct from the H type
 *
 * @return A Coproduct21 where the
 * receiver is the H
 */
fun  H.eighth(): Coproduct21 = Eighth(this)

/**
 * Creates a Coproduct from the I type
 *
 * @return A Coproduct21 where the
 * receiver is the I
 */
fun  I.ninth(): Coproduct21 = Ninth(this)

/**
 * Creates a Coproduct from the J type
 *
 * @return A Coproduct21 where the
 * receiver is the J
 */
fun  J.tenth(): Coproduct21 = Tenth(this)

/**
 * Creates a Coproduct from the K type
 *
 * @return A Coproduct21 where the
 * receiver is the K
 */
fun  K.eleventh(): Coproduct21 = Eleventh(this)

/**
 * Creates a Coproduct from the L type
 *
 * @return A Coproduct21 where the
 * receiver is the L
 */
fun  L.twelfth(): Coproduct21 = Twelfth(this)

/**
 * Creates a Coproduct from the M type
 *
 * @return A Coproduct21 where the
 * receiver is the M
 */
fun  M.thirteenth(): Coproduct21 = Thirteenth(this)

/**
 * Creates a Coproduct from the N type
 *
 * @return A Coproduct21 where the
 * receiver is the N
 */
fun  N.fourteenth(): Coproduct21 = Fourteenth(this)

/**
 * Creates a Coproduct from the O type
 *
 * @return A Coproduct21 where the
 * receiver is the O
 */
fun  O.fifteenth(): Coproduct21 = Fifteenth(this)

/**
 * Creates a Coproduct from the P type
 *
 * @return A Coproduct21 where the
 * receiver is the P
 */
fun  P.sixteenth(): Coproduct21 = Sixteenth(this)

/**
 * Creates a Coproduct from the Q type
 *
 * @return A Coproduct21 where the
 * receiver is the Q
 */
fun  Q.seventeenth(): Coproduct21 = Seventeenth(this)

/**
 * Creates a Coproduct from the R type
 *
 * @return A Coproduct21 where the
 * receiver is the R
 */
fun  R.eighteenth(): Coproduct21 = Eighteenth(this)

/**
 * Creates a Coproduct from the S type
 *
 * @return A Coproduct21 where the
 * receiver is the S
 */
fun  S.nineteenth(): Coproduct21 = Nineteenth(this)

/**
 * Creates a Coproduct from the T type
 *
 * @return A Coproduct21 where the
 * receiver is the T
 */
fun  T.twentieth(): Coproduct21 = Twentieth(this)

/**
 * Creates a Coproduct from the U type
 *
 * @return A Coproduct21 where the
 * receiver is the U
 */
fun  U.twentyFirst(): Coproduct21 = TwentyFirst(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  Coproduct21.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  Coproduct21<*, 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  Coproduct21<*, *, 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  Coproduct21<*, *, *, 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  Coproduct21<*, *, *, *, 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  Coproduct21<*, *, *, *, *, 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  Coproduct21<*, *, *, *, *, *, 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  Coproduct21<*, *, *, *, *, *, *, 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  Coproduct21<*, *, *, *, *, *, *, *, 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  Coproduct21<*, *, *, *, *, *, *, *, *, 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  Coproduct21<*, *, *, *, *, *, *, *, *, *, 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  Coproduct21<*, *, *, *, *, *, *, *, *, *, *, 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  Coproduct21<*, *, *, *, *, *, *, *, *, *, *, *, 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()

/**
 * 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  Coproduct21<*, *, *, *, *, *, *, *, *, *, *, *, *, N, *, *, *, *, *, *, *>.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,
    dummy12: Unit = Unit
): Option = (this as? Fourteenth)?.n.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  Coproduct21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, O, *, *, *, *, *, *>.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,
    dummy12: Unit = Unit,
    dummy13: Unit = Unit
): Option = (this as? Fifteenth)?.o.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 

Coproduct21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, P, *, *, *, *, *>.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, dummy12: Unit = Unit, dummy13: Unit = Unit, dummy14: Unit = Unit ): Option

= (this as? Sixteenth)?.p.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 Coproduct21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, Q, *, *, *, *>.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, dummy12: Unit = Unit, dummy13: Unit = Unit, dummy14: Unit = Unit, dummy15: Unit = Unit ): Option = (this as? Seventeenth)?.q.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 Coproduct21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, R, *, *, *>.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, dummy12: Unit = Unit, dummy13: Unit = Unit, dummy14: Unit = Unit, dummy15: Unit = Unit, dummy16: Unit = Unit ): Option = (this as? Eighteenth)?.r.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 Coproduct21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, S, *, *>.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, dummy12: Unit = Unit, dummy13: Unit = Unit, dummy14: Unit = Unit, dummy15: Unit = Unit, dummy16: Unit = Unit, dummy17: Unit = Unit ): Option = (this as? Nineteenth)?.s.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 Coproduct21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, T, *>.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, dummy12: Unit = Unit, dummy13: Unit = Unit, dummy14: Unit = Unit, dummy15: Unit = Unit, dummy16: Unit = Unit, dummy17: Unit = Unit, dummy18: Unit = Unit ): Option = (this as? Twentieth)?.t.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 Coproduct21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, U>.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, dummy12: Unit = Unit, dummy13: Unit = Unit, dummy14: Unit = Unit, dummy15: Unit = Unit, dummy16: Unit = Unit, dummy17: Unit = Unit, dummy18: Unit = Unit, dummy19: Unit = Unit ): Option = (this as? TwentyFirst)?.u.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 * @param n The function used to map N to the RESULT type * @param o The function used to map O to the RESULT type * @param p The function used to map P to the RESULT type * @param q The function used to map Q to the RESULT type * @param r The function used to map R to the RESULT type * @param s The function used to map S to the RESULT type * @param t The function used to map T to the RESULT type * @param u The function used to map U to the RESULT type * * @return RESULT generated by one of the input functions */ fun Coproduct21.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, n: (N) -> RESULT, o: (O) -> RESULT, p: (P) -> RESULT, q: (Q) -> RESULT, r: (R) -> RESULT, s: (S) -> RESULT, t: (T) -> RESULT, u: (U) -> 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) is Fourteenth -> n(this.n) is Fifteenth -> o(this.o) is Sixteenth -> p(this.p) is Seventeenth -> q(this.q) is Eighteenth -> r(this.r) is Nineteenth -> s(this.s) is Twentieth -> t(this.t) is TwentyFirst -> u(this.u) }