Explorer

core.type-substitute-variants

description
core.type-substitute for each payload type of a union type
type
Fn(
  variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
  arguments: List<Record{name: String, type: @core.type-ast}>,
  index: Number,
  accum: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>
) -> List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>
expression
fn(variants$0, arguments$1, index$2, accum$3) =>
  match @core.list-get(list: $0, index: $2) {
    #none(_) =>
      $3,
    #some(variant$4) =>
      @core.type-substitute-variants(
        variants: $0,
        arguments: $1,
        index: @core.plus(left: $2, right: 1),
        accum: @core.list-append(
          list: $3,
          item: {
            tag: $4.tag,
            payload_type: match $4.payload_type {
              #none(_) =>
                #none,
              #some(payload_type$5) =>
                #some(@core.type-substitute(type: $5, arguments: $1))
            }
          }
        )
      )
  }
visibility
public
core.type-substitute-variants (project definy, branch auto-release, snapshot oiQgPqhJm-TbM4kexXeRHBaJB_tS7gwBSewII64P-44)
id: Ny07kW7rYszGtwrhacoWNbDH_s5eKXL8nwEKjN7vMLo
content hash: ssTTPhSg4UhduWjek4nyAh_AwfHUixrvchJ2rgo7xgU