Explorer

core.value-to-project-snapshot

description
Read a value of the evaluator (core.value) as core.project-snapshot. none if the shape differs (generated by scripts/generate_value_decoders.ts)
type
Fn(value: @core.value) -> Union{#none, #some(@core.project-snapshot)}
expression
fn(value$0) =>
  match $0 {
    #record(fields$1) =>
      match @core.value-record-field(fields: $1, key: "project_name", index: 0) {
        #some(field$2) =>
          match @core.value-decoded(
              T: String,
              decoded: match $2 {
                #string(v$4) =>
                  #some($4),
                _ =>
                  #none
              }
            ) {
            #some(project_name$3) =>
              match @core.value-record-field(fields: $1, key: "branch", index: 0) {
                #some(field$5) =>
                  match @core.value-decoded(
                      T: String,
                      decoded: match $5 {
                        #string(v$7) =>
                          #some($7),
                        _ =>
                          #none
                      }
                    ) {
                    #some(branch$6) =>
                      match @core.value-record-field(fields: $1, key: "project_description", index: 0) {
                        #some(field$8) =>
                          match @core.value-decoded(
                              T: List<@core.localized-text>,
                              decoded: match $8 {
                                #list(items$10) =>
                                  @core.value-to-list(
                                    T: @core.localized-text,
                                    items: $10,
                                    decode: fn(value$11) =>
                                      @core.value-to-localized-text(value: $11),
                                    index: 0,
                                    acc: []
                                  ),
                                _ =>
                                  #none
                              }
                            ) {
                            #some(project_description$9) =>
                              match @core.value-record-field(fields: $1, key: "message", index: 0) {
                                #some(field$12) =>
                                  match @core.value-decoded(
                                      T: String,
                                      decoded: match $12 {
                                        #string(v$14) =>
                                          #some($14),
                                        _ =>
                                          #none
                                      }
                                    ) {
                                    #some(message$13) =>
                                      match @core.value-record-field(fields: $1, key: "parent_commit_hash", index: 0) {
                                        #some(field$15) =>
                                          match @core.value-decoded(
                                              T: Union{#none, #some(String)},
                                              decoded: match $15 {
                                                #variant(variant$17) =>
                                                  match $17.tag {
                                                    "none" =>
                                                      #some(#none),
                                                    "some" =>
                                                      match @core.value-decoded(
                                                          T: String,
                                                          decoded: match $17.payload {
                                                            #string(v$19) =>
                                                              #some($19),
                                                            _ =>
                                                              #none
                                                          }
                                                        ) {
                                                        #some(payload$18) =>
                                                          #some(#some($18)),
                                                        _ =>
                                                          #none
                                                      },
                                                    _ =>
                                                      #none
                                                  },
                                                _ =>
                                                  #none
                                              }
                                            ) {
                                            #some(parent_commit_hash$16) =>
                                              match @core.value-record-field(fields: $1, key: "merged_commit_hash", index: 0) {
                                                #some(field$20) =>
                                                  match @core.value-decoded(
                                                      T: Union{#none, #some(String)},
                                                      decoded: match $20 {
                                                        #variant(variant$22) =>
                                                          match $22.tag {
                                                            "none" =>
                                                              #some(#none),
                                                            "some" =>
                                                              match @core.value-decoded(
                                                                  T: String,
                                                                  decoded: match $22.payload {
                                                                    #string(v$24) =>
                                                                      #some($24),
                                                                    _ =>
                                                                      #none
                                                                  }
                                                                ) {
                                                                #some(payload$23) =>
                                                                  #some(#some($23)),
                                                                _ =>
                                                                  #none
                                                              },
                                                            _ =>
                                                              #none
                                                          },
                                                        _ =>
                                                          #none
                                                      }
                                                    ) {
                                                    #some(merged_commit_hash$21) =>
                                                      match @core.value-record-field(fields: $1, key: "modules", index: 0) {
                                                        #some(field$25) =>
                                                          match @core.value-decoded(
                                                              T: List<@core.project-snapshot-module>,
                                                              decoded: match $25 {
                                                                #list(items$27) =>
                                                                  @core.value-to-list(
                                                                    T: @core.project-snapshot-module,
                                                                    items: $27,
                                                                    decode: fn(value$28) =>
                                                                      @core.value-to-project-snapshot-module(value: $28),
                                                                    index: 0,
                                                                    acc: []
                                                                  ),
                                                                _ =>
                                                                  #none
                                                              }
                                                            ) {
                                                            #some(modules$26) =>
                                                              #some({
                                                                project_name: $3,
                                                                branch: $6,
                                                                project_description: $9,
                                                                message: $13,
                                                                parent_commit_hash: $16,
                                                                merged_commit_hash: $21,
                                                                modules: $26
                                                              }),
                                                            _ =>
                                                              #none
                                                          },
                                                        _ =>
                                                          #none
                                                      },
                                                    _ =>
                                                      #none
                                                  },
                                                _ =>
                                                  #none
                                              },
                                            _ =>
                                              #none
                                          },
                                        _ =>
                                          #none
                                      },
                                    _ =>
                                      #none
                                  },
                                _ =>
                                  #none
                              },
                            _ =>
                              #none
                          },
                        _ =>
                          #none
                      },
                    _ =>
                      #none
                  },
                _ =>
                  #none
              },
            _ =>
              #none
          },
        _ =>
          #none
      },
    _ =>
      #none
  }
visibility
public
core.value-to-project-snapshot (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204)
id: 0ieqst31V_Gtkx6DdBeXrhzKkPpS-ARf8ODkUvpoCWo
content hash: UyoCcsEDhf8HEybqm3jWvH-gtLllgu9ieSUgpqykTpM