Packages

Use constructors directly with tuples

Current section

Files

Jump to
tupler src tupler@construct.erl
Raw

src/tupler@construct.erl

-module(tupler@construct).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([one/2, two/2, three/2, four/2, five/2, six/2, seven/2, eight/2, nine/2]).
-spec one({FQU}, fun((FQU) -> FQV)) -> FQV.
one(Tuple, Constructor) ->
{First} = Tuple,
Constructor(First).
-spec two({FQW, FQX}, fun((FQW, FQX) -> FQY)) -> FQY.
two(Tuple, Constructor) ->
{First, Second} = Tuple,
Constructor(First, Second).
-spec three({FQZ, FRA, FRB}, fun((FQZ, FRA, FRB) -> FRC)) -> FRC.
three(Tuple, Constructor) ->
{First, Second, Third} = Tuple,
Constructor(First, Second, Third).
-spec four({FRD, FRE, FRF, FRG}, fun((FRD, FRE, FRF, FRG) -> FRH)) -> FRH.
four(Tuple, Constructor) ->
{First, Second, Third, Fourth} = Tuple,
Constructor(First, Second, Third, Fourth).
-spec five({FRI, FRJ, FRK, FRL, FRM}, fun((FRI, FRJ, FRK, FRL, FRM) -> FRN)) -> FRN.
five(Tuple, Constructor) ->
{First, Second, Third, Fourth, Fifth} = Tuple,
Constructor(First, Second, Third, Fourth, Fifth).
-spec six(
{FRO, FRP, FRQ, FRR, FRS, FRT},
fun((FRO, FRP, FRQ, FRR, FRS, FRT) -> FRU)
) -> FRU.
six(Tuple, Constructor) ->
{First, Second, Third, Fourth, Fifth, Sixth} = Tuple,
Constructor(First, Second, Third, Fourth, Fifth, Sixth).
-spec seven(
{FRV, FRW, FRX, FRY, FRZ, FSA, FSB},
fun((FRV, FRW, FRX, FRY, FRZ, FSA, FSB) -> FSC)
) -> FSC.
seven(Tuple, Constructor) ->
{First, Second, Third, Fourth, Fifth, Sixth, Seventh} = Tuple,
Constructor(First, Second, Third, Fourth, Fifth, Sixth, Seventh).
-spec eight(
{FSD, FSE, FSF, FSG, FSH, FSI, FSJ, FSK},
fun((FSD, FSE, FSF, FSG, FSH, FSI, FSJ, FSK) -> FSL)
) -> FSL.
eight(Tuple, Constructor) ->
{First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth} = Tuple,
Constructor(First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth).
-spec nine(
{FSM, FSN, FSO, FSP, FSQ, FSR, FSS, FST, FSU},
fun((FSM, FSN, FSO, FSP, FSQ, FSR, FSS, FST, FSU) -> FSV)
) -> FSV.
nine(Tuple, Constructor) ->
{First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Nineth} = Tuple,
Constructor(
First,
Second,
Third,
Fourth,
Fifth,
Sixth,
Seventh,
Eighth,
Nineth
).