Explorer

core.type-equals-union-variants

description
Recursively compare ordered union type variants
type
Fn(
  left_variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
  right_variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
  index: Number
) -> Boolean
expression
fn(left_variants$0, right_variants$1, index$2) =>
  match @core.list-get(list: $0, index: $2) {
    #none(_) =>
      @core.less-than-or-equal(left: @core.list-length(value: $1), right: $2),
    #some(item$1005) =>
      match @core.list-get(list: $1, index: $2) {
        #none(_) =>
          false,
        #some(item$1006) =>
          match @core.equal(left: $1005.tag, right: $1006.tag) {
            true =>
              match match $1005.payload_type {
                  #none(_) =>
                    match $1006.payload_type {
                      #none(_) =>
                        true,
                      _ =>
                        false
                    },
                  #some(""$3) =>
                    match $1006.payload_type {
                      #some(""$4) =>
                        @core.type-equals(t1: $3, t2: $4),
                      _ =>
                        false
                    },
                  _ =>
                    false
                } {
                true =>
                  @core.type-equals-union-variants(left_variants: $0, right_variants: $1, index: @core.plus(left: $2, right: 1)),
                false =>
                  false
              },
            false =>
              false
          }
      }
  }
visibility
public
core.type-equals-union-variants (project definy, branch compiled-tests, snapshot i6TqClmqVS9FK8rKOvJ43l6Tevx8pvYJ5-zaQqNwemc)
id: nEceoEgu1FZZvxr_fLagqAmiLvdEiushkO5cwfqrcjw
content hash: 1mBJ8ElFKzcl82vnuFfeX6VEsFA3BdYJfwojgr7q7aE