Explorer

core.value-to-project-snapshot-module

description
Read a value of the evaluator (core.value) as core.project-snapshot-module. none if the shape differs (generated by scripts/generate_value_decoders.ts)
type
Fn(value: @core.value) -> Union{#none, #some(@core.project-snapshot-module)}
expression
fn(value$0) =>
  match $0 {
    #record(fields$1) =>
      match @core.value-record-field(fields: $1, key: "name", index: 0) {
        #some(field$2) =>
          match @core.value-decoded(
              T: String,
              decoded: match $2 {
                #string(v$4) =>
                  #some($4),
                _ =>
                  #none
              }
            ) {
            #some(name$3) =>
              match @core.value-record-field(fields: $1, key: "description", index: 0) {
                #some(field$5) =>
                  match @core.value-decoded(
                      T: List<@core.localized-text>,
                      decoded: match $5 {
                        #list(items$7) =>
                          @core.value-to-list(
                            T: @core.localized-text,
                            items: $7,
                            decode: fn(value$8) =>
                              @core.value-to-localized-text(value: $8),
                            index: 0,
                            acc: []
                          ),
                        _ =>
                          #none
                      }
                    ) {
                    #some(description$6) =>
                      match @core.value-record-field(fields: $1, key: "visibility", index: 0) {
                        #some(field$9) =>
                          match @core.value-to-visibility(value: $9) {
                            #some(visibility$10) =>
                              match @core.value-record-field(fields: $1, key: "parts", index: 0) {
                                #some(field$11) =>
                                  match @core.value-decoded(
                                      T: List<@core.module-snapshot-part>,
                                      decoded: match $11 {
                                        #list(items$13) =>
                                          @core.value-to-list(
                                            T: @core.module-snapshot-part,
                                            items: $13,
                                            decode: fn(value$14) =>
                                              @core.value-to-module-snapshot-part(value: $14),
                                            index: 0,
                                            acc: []
                                          ),
                                        _ =>
                                          #none
                                      }
                                    ) {
                                    #some(parts$12) =>
                                      #some({name: $3, description: $6, visibility: $10, parts: $12}),
                                    _ =>
                                      #none
                                  },
                                _ =>
                                  #none
                              },
                            _ =>
                              #none
                          },
                        _ =>
                          #none
                      },
                    _ =>
                      #none
                  },
                _ =>
                  #none
              },
            _ =>
              #none
          },
        _ =>
          #none
      },
    _ =>
      #none
  }
visibility
public
core.value-to-project-snapshot-module (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204)
id: App0mAjWaELjVUQxKa51wzbWh1tkO1GICrirMLNpt_Q
content hash: yXxNw1F2TRwmpwZsWdsNrUEoiNtfQDWQ9R52M_nHpqg