Explorer

core.compile-type-level

description
Whether the expression is a type: a type expression (core.is-type-expression), a reference to a part that is a type, or a call of a part that is a function returning a type expression (a type application such as definy.service-io = @definy.io(A: ...)). index is a core.list-hash-index of the parts by id
type
Fn(expr: @core.expression, index: List<List<Record{id: String, expression: @core.expression}>>) -> Boolean
expression
fn(expr$0, index$1) =>
  match @core.is-type-expression(expr: $0) {
    true =>
      true,
    false =>
      match $0 {
        #part_reference(reference$2) =>
          match @core.list-hash-index-find(index: $1, field: "id", value: $2.part_definition_event_hash) {
            #some(part$3) =>
              @core.compile-type-level(expr: $3.expression, index: $1),
            #none(_) =>
              false
          },
        #call(call$4) =>
          match $4.function {
            #part_reference(reference$5) =>
              match @core.list-hash-index-find(index: $1, field: "id", value: $5.part_definition_event_hash) {
                #some(part$6) =>
                  match $6.expression {
                    #function(function$7) =>
                      @core.compile-type-level(expr: $7.body, index: $1),
                    _ =>
                      false
                  },
                #none(_) =>
                  false
              },
            _ =>
              false
          },
        _ =>
          false
      }
  }
visibility
public
core.compile-type-level (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204)
id: rM49k-Z95etDHBaJNzBNWz2HGLrEJxoh8z-pIp_F1ec
content hash: rUdYGxZfN6eITN94UvGekinWdV7_2pWaX_3fYWNT2PA