Packages

Type unions without wrappers.

Current section

Files

Jump to
untag src untag.erl
Raw

src/untag.erl

-module(untag).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/untag.gleam").
-export([id/1, to_dynamic/1, decode/2, flip/1, flip_tail/1, flipped/2, flip_head/1, give/1, give2/1, give3/1, give4/1, give5/1, give6/1, give7/1, give8/1, take/1, take2/1, take3/1, take4/1, take5/1, take6/1, take7/1, take8/1, rev3_with_tail/1, rev4_with_tail/1, rev5_with_tail/1, rev6_with_tail/1, rev7_with_tail/1, rev8_with_tail/1, rev9_with_tail/1, rev10_with_tail/1, tail_3rd/1, tail_4th/1, tail_5th/1, tail_6th/1, tail_7th/1, tail_8th/1, tail_9th/1, tail_10th/1, head_2nd/1, head_3th/1, head_4th/1, head_5th/1, head_6th/1, head_7th/1, head_8th/1, head_9th/1, head_10th/1]).
-export_type(['or'/2]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" The type `Or` is an type union with no wrapping.\n"
" `Or2(Int, String, Float)` is the same as `Int | String | Float`, \n"
" not `{Left, Int} | {Right, {Left, String} | {Right, Float}}`\n"
).
-type 'or'(EDZ, EEA) :: any() | {gleam_phantom, EDZ, EEA}.
-file("src/untag.gleam", 11).
?DOC(false).
-spec id(any()) -> any().
id(X) ->
untag_ffi:id(X).
-file("src/untag.gleam", 13).
-spec to_dynamic('or'(any(), any())) -> gleam@dynamic:dynamic_().
to_dynamic(Or) ->
untag_ffi:id(Or).
-file("src/untag.gleam", 17).
-spec decode('or'(any(), any()), gleam@dynamic@decode:decoder(EIQ)) -> {ok, EIQ} |
{error, list(gleam@dynamic@decode:decode_error())}.
decode(Or, Decoder) ->
_pipe = Or,
_pipe@1 = to_dynamic(_pipe),
gleam@dynamic@decode:run(_pipe@1, Decoder).
-file("src/untag.gleam", 132).
-spec flip('or'(EKH, EKI)) -> 'or'(EKI, EKH).
flip(Or) ->
untag_ffi:id(Or).
-file("src/untag.gleam", 136).
-spec flip_tail('or'(EKN, 'or'(EKO, EKP))) -> 'or'(EKN, 'or'(EKP, EKO)).
flip_tail(Or) ->
untag_ffi:id(Or).
-file("src/untag.gleam", 144).
-spec flipped('or'(EOC, EOD), fun(('or'(EOD, EOC)) -> 'or'(EOG, EOH))) -> 'or'(EOH, EOG).
flipped(Or, F) ->
_pipe = Or,
_pipe@1 = flip(_pipe),
_pipe@2 = F(_pipe@1),
flip(_pipe@2).
-file("src/untag.gleam", 140).
-spec flip_head('or'('or'(EOO, EOP), EON)) -> 'or'('or'(EOP, EOO), EON).
flip_head(Or) ->
_pipe = Or,
flipped(_pipe, fun flip_tail/1).
-file("src/untag.gleam", 148).
-spec give('or'('or'(ELD, ELE), ELH)) -> 'or'(ELE, 'or'(ELD, ELH)).
give(Or) ->
untag_ffi:id(Or).
-file("src/untag.gleam", 152).
-spec give2('or'('or'(EOS, 'or'(EOW, EOX)), EOU)) -> 'or'(EOX, 'or'(EOW, 'or'(EOS, EOU))).
give2(Or) ->
_pipe = Or,
_pipe@1 = give(_pipe),
give(_pipe@1).
-file("src/untag.gleam", 156).
-spec give3('or'('or'(EPA, 'or'(EPE, 'or'(EPF, EPG))), EPC)) -> 'or'(EPG, 'or'(EPF, 'or'(EPE, 'or'(EPA, EPC)))).
give3(Or) ->
_pipe = Or,
_pipe@1 = give(_pipe),
give2(_pipe@1).
-file("src/untag.gleam", 160).
-spec give4('or'('or'(EPJ, 'or'(EPN, 'or'(EPO, 'or'(EPP, EPQ)))), EPL)) -> 'or'(EPQ, 'or'(EPP, 'or'(EPO, 'or'(EPN, 'or'(EPJ, EPL))))).
give4(Or) ->
_pipe = Or,
_pipe@1 = give(_pipe),
give3(_pipe@1).
-file("src/untag.gleam", 164).
-spec give5(
'or'('or'(EPT, 'or'(EPX, 'or'(EPY, 'or'(EPZ, 'or'(EQA, EQB))))), EPV)
) -> 'or'(EQB, 'or'(EQA, 'or'(EPZ, 'or'(EPY, 'or'(EPX, 'or'(EPT, EPV)))))).
give5(Or) ->
_pipe = Or,
_pipe@1 = give(_pipe),
give4(_pipe@1).
-file("src/untag.gleam", 168).
-spec give6(
'or'('or'(EQE, 'or'(EQI, 'or'(EQJ, 'or'(EQK, 'or'(EQL, 'or'(EQM, EQN)))))), EQG)
) -> 'or'(EQN, 'or'(EQM, 'or'(EQL, 'or'(EQK, 'or'(EQJ, 'or'(EQI, 'or'(EQE, EQG))))))).
give6(Or) ->
_pipe = Or,
_pipe@1 = give(_pipe),
give5(_pipe@1).
-file("src/untag.gleam", 172).
-spec give7(
'or'('or'(EQQ, 'or'(EQU, 'or'(EQV, 'or'(EQW, 'or'(EQX, 'or'(EQY, 'or'(EQZ, ERA))))))), EQS)
) -> 'or'(ERA, 'or'(EQZ, 'or'(EQY, 'or'(EQX, 'or'(EQW, 'or'(EQV, 'or'(EQU, 'or'(EQQ, EQS)))))))).
give7(Or) ->
_pipe = Or,
_pipe@1 = give(_pipe),
give6(_pipe@1).
-file("src/untag.gleam", 176).
-spec give8(
'or'('or'(ERD, 'or'(ERH, 'or'(ERI, 'or'(ERJ, 'or'(ERK, 'or'(ERL, 'or'(ERM, 'or'(ERN, ERO)))))))), ERF)
) -> 'or'(ERO, 'or'(ERN, 'or'(ERM, 'or'(ERL, 'or'(ERK, 'or'(ERJ, 'or'(ERI, 'or'(ERH, 'or'(ERD, ERF))))))))).
give8(Or) ->
_pipe = Or,
_pipe@1 = give(_pipe),
give7(_pipe@1).
-file("src/untag.gleam", 180).
-spec take('or'(EMC, 'or'(EMD, EME))) -> 'or'('or'(EMD, EMC), EME).
take(Or) ->
_pipe = Or,
flipped(_pipe, fun give/1).
-file("src/untag.gleam", 184).
-spec take2('or'(ERY, 'or'(ERZ, 'or'(ESD, ESE)))) -> 'or'('or'(ESD, 'or'(ERZ, ERY)), ESE).
take2(Or) ->
_pipe = Or,
_pipe@1 = take(_pipe),
take(_pipe@1).
-file("src/untag.gleam", 188).
-spec take3('or'(ESG, 'or'(ESH, 'or'(ESL, 'or'(ESM, ESN))))) -> 'or'('or'(ESM, 'or'(ESL, 'or'(ESH, ESG))), ESN).
take3(Or) ->
_pipe = Or,
_pipe@1 = take(_pipe),
take2(_pipe@1).
-file("src/untag.gleam", 192).
-spec take4('or'(ESP, 'or'(ESQ, 'or'(ESU, 'or'(ESV, 'or'(ESW, ESX)))))) -> 'or'('or'(ESW, 'or'(ESV, 'or'(ESU, 'or'(ESQ, ESP)))), ESX).
take4(Or) ->
_pipe = Or,
_pipe@1 = take(_pipe),
take3(_pipe@1).
-file("src/untag.gleam", 196).
-spec take5(
'or'(ESZ, 'or'(ETA, 'or'(ETE, 'or'(ETF, 'or'(ETG, 'or'(ETH, ETI))))))
) -> 'or'('or'(ETH, 'or'(ETG, 'or'(ETF, 'or'(ETE, 'or'(ETA, ESZ))))), ETI).
take5(Or) ->
_pipe = Or,
_pipe@1 = take(_pipe),
take4(_pipe@1).
-file("src/untag.gleam", 200).
-spec take6(
'or'(ETK, 'or'(ETL, 'or'(ETP, 'or'(ETQ, 'or'(ETR, 'or'(ETS, 'or'(ETT, ETU)))))))
) -> 'or'('or'(ETT, 'or'(ETS, 'or'(ETR, 'or'(ETQ, 'or'(ETP, 'or'(ETL, ETK)))))), ETU).
take6(Or) ->
_pipe = Or,
_pipe@1 = take(_pipe),
take5(_pipe@1).
-file("src/untag.gleam", 204).
-spec take7(
'or'(ETW, 'or'(ETX, 'or'(EUB, 'or'(EUC, 'or'(EUD, 'or'(EUE, 'or'(EUF, 'or'(EUG, EUH))))))))
) -> 'or'('or'(EUG, 'or'(EUF, 'or'(EUE, 'or'(EUD, 'or'(EUC, 'or'(EUB, 'or'(ETX, ETW))))))), EUH).
take7(Or) ->
_pipe = Or,
_pipe@1 = take(_pipe),
take6(_pipe@1).
-file("src/untag.gleam", 208).
-spec take8(
'or'(EUJ, 'or'(EUK, 'or'(EUO, 'or'(EUP, 'or'(EUQ, 'or'(EUR, 'or'(EUS, 'or'(EUT, 'or'(EUU, EUV)))))))))
) -> 'or'('or'(EUU, 'or'(EUT, 'or'(EUS, 'or'(EUR, 'or'(EUQ, 'or'(EUP, 'or'(EUO, 'or'(EUK, EUJ)))))))), EUV).
take8(Or) ->
_pipe = Or,
_pipe@1 = take(_pipe),
take7(_pipe@1).
-file("src/untag.gleam", 212).
-spec rev3_with_tail('or'(EUX, 'or'(EVA, EVB))) -> 'or'(EVB, 'or'(EVA, EUX)).
rev3_with_tail(Or) ->
_pipe = Or,
_pipe@1 = flip(_pipe),
give(_pipe@1).
-file("src/untag.gleam", 216).
-spec rev4_with_tail('or'(EVE, 'or'(EVF, 'or'(EVI, EVJ)))) -> 'or'(EVJ, 'or'(EVI, 'or'(EVF, EVE))).
rev4_with_tail(Or) ->
_pipe = Or,
_pipe@1 = rev3_with_tail(_pipe),
give(_pipe@1).
-file("src/untag.gleam", 220).
-spec rev5_with_tail('or'(EVM, 'or'(EVN, 'or'(EVO, 'or'(EVR, EVS))))) -> 'or'(EVS, 'or'(EVR, 'or'(EVO, 'or'(EVN, EVM)))).
rev5_with_tail(Or) ->
_pipe = Or,
_pipe@1 = rev4_with_tail(_pipe),
give(_pipe@1).
-file("src/untag.gleam", 224).
-spec rev6_with_tail('or'(EVV, 'or'(EVW, 'or'(EVX, 'or'(EVY, 'or'(EWB, EWC)))))) -> 'or'(EWC, 'or'(EWB, 'or'(EVY, 'or'(EVX, 'or'(EVW, EVV))))).
rev6_with_tail(Or) ->
_pipe = Or,
_pipe@1 = rev5_with_tail(_pipe),
give(_pipe@1).
-file("src/untag.gleam", 228).
-spec rev7_with_tail(
'or'(EWF, 'or'(EWG, 'or'(EWH, 'or'(EWI, 'or'(EWJ, 'or'(EWM, EWN))))))
) -> 'or'(EWN, 'or'(EWM, 'or'(EWJ, 'or'(EWI, 'or'(EWH, 'or'(EWG, EWF)))))).
rev7_with_tail(Or) ->
_pipe = Or,
_pipe@1 = rev6_with_tail(_pipe),
give(_pipe@1).
-file("src/untag.gleam", 232).
-spec rev8_with_tail(
'or'(EWQ, 'or'(EWR, 'or'(EWS, 'or'(EWT, 'or'(EWU, 'or'(EWV, 'or'(EWY, EWZ)))))))
) -> 'or'(EWZ, 'or'(EWY, 'or'(EWV, 'or'(EWU, 'or'(EWT, 'or'(EWS, 'or'(EWR, EWQ))))))).
rev8_with_tail(Or) ->
_pipe = Or,
_pipe@1 = rev7_with_tail(_pipe),
give(_pipe@1).
-file("src/untag.gleam", 236).
-spec rev9_with_tail(
'or'(EXC, 'or'(EXD, 'or'(EXE, 'or'(EXF, 'or'(EXG, 'or'(EXH, 'or'(EXI, 'or'(EXL, EXM))))))))
) -> 'or'(EXM, 'or'(EXL, 'or'(EXI, 'or'(EXH, 'or'(EXG, 'or'(EXF, 'or'(EXE, 'or'(EXD, EXC)))))))).
rev9_with_tail(Or) ->
_pipe = Or,
_pipe@1 = rev8_with_tail(_pipe),
give(_pipe@1).
-file("src/untag.gleam", 240).
-spec rev10_with_tail(
'or'(EXP, 'or'(EXQ, 'or'(EXR, 'or'(EXS, 'or'(EXT, 'or'(EXU, 'or'(EXV, 'or'(EXW, 'or'(EXZ, EYA)))))))))
) -> 'or'(EYA, 'or'(EXZ, 'or'(EXW, 'or'(EXV, 'or'(EXU, 'or'(EXT, 'or'(EXS, 'or'(EXR, 'or'(EXQ, EXP))))))))).
rev10_with_tail(Or) ->
_pipe = Or,
_pipe@1 = rev9_with_tail(_pipe),
give(_pipe@1).
-file("src/untag.gleam", 89).
-spec head_in(fun(('or'(EJN, any())) -> EYK), EJN) -> EYK.
head_in(Tn, X) ->
Tn(untag_ffi:id(X)).
-file("src/untag.gleam", 51).
-spec tail_in(fun(('or'(any(), EIU)) -> EYU), EIU) -> EYU.
tail_in(Tn, X) ->
Tn(untag_ffi:id(X)).
-file("src/untag.gleam", 57).
-spec tail_3rd(EIW) -> 'or'(any(), 'or'(any(), EIW)).
tail_3rd(X) ->
_pipe = fun untag_ffi:id/1,
tail_in(_pipe, X).
-file("src/untag.gleam", 61).
-spec tail_4th(EIY) -> 'or'(any(), 'or'(any(), 'or'(any(), EIY))).
tail_4th(X) ->
_pipe = fun tail_3rd/1,
tail_in(_pipe, X).
-file("src/untag.gleam", 65).
-spec tail_5th(EJA) -> 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), EJA)))).
tail_5th(X) ->
_pipe = fun tail_4th/1,
tail_in(_pipe, X).
-file("src/untag.gleam", 69).
-spec tail_6th(EJC) -> 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), EJC))))).
tail_6th(X) ->
_pipe = fun tail_5th/1,
tail_in(_pipe, X).
-file("src/untag.gleam", 73).
-spec tail_7th(EJE) -> 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), EJE)))))).
tail_7th(X) ->
_pipe = fun tail_6th/1,
tail_in(_pipe, X).
-file("src/untag.gleam", 77).
-spec tail_8th(EJG) -> 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), EJG))))))).
tail_8th(X) ->
_pipe = fun tail_7th/1,
tail_in(_pipe, X).
-file("src/untag.gleam", 81).
-spec tail_9th(EJI) -> 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), EJI)))))))).
tail_9th(X) ->
_pipe = fun tail_8th/1,
tail_in(_pipe, X).
-file("src/untag.gleam", 85).
-spec tail_10th(EJK) -> 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), EJK))))))))).
tail_10th(X) ->
_pipe = fun tail_9th/1,
tail_in(_pipe, X).
-file("src/untag.gleam", 96).
-spec head_2nd(EJP) -> 'or'(any(), 'or'(EJP, any())).
head_2nd(X) ->
_pipe = fun untag_ffi:id/1,
head_in(_pipe, X).
-file("src/untag.gleam", 100).
-spec head_3th(EJR) -> 'or'(any(), 'or'(any(), 'or'(EJR, any()))).
head_3th(X) ->
_pipe = fun tail_3rd/1,
head_in(_pipe, X).
-file("src/untag.gleam", 104).
-spec head_4th(EJT) -> 'or'(any(), 'or'(any(), 'or'(any(), 'or'(EJT, any())))).
head_4th(X) ->
_pipe = fun tail_4th/1,
head_in(_pipe, X).
-file("src/untag.gleam", 108).
-spec head_5th(EJV) -> 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(EJV, any()))))).
head_5th(X) ->
_pipe = fun tail_5th/1,
head_in(_pipe, X).
-file("src/untag.gleam", 112).
-spec head_6th(EJX) -> 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(EJX, any())))))).
head_6th(X) ->
_pipe = fun tail_6th/1,
head_in(_pipe, X).
-file("src/untag.gleam", 116).
-spec head_7th(EJZ) -> 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(EJZ, any()))))))).
head_7th(X) ->
_pipe = fun tail_7th/1,
head_in(_pipe, X).
-file("src/untag.gleam", 120).
-spec head_8th(EKB) -> 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(EKB, any())))))))).
head_8th(X) ->
_pipe = fun tail_8th/1,
head_in(_pipe, X).
-file("src/untag.gleam", 124).
-spec head_9th(EKD) -> 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(EKD, any()))))))))).
head_9th(X) ->
_pipe = fun tail_9th/1,
head_in(_pipe, X).
-file("src/untag.gleam", 128).
-spec head_10th(EKF) -> 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(any(), 'or'(EKF, any())))))))))).
head_10th(X) ->
_pipe = fun tail_10th/1,
head_in(_pipe, X).