Explorer

definy.localized-text-literal

description
The value of a literal { language, text }
type
Fn(expr: @core.expression) -> Union{#none, #some(@core.localized-text)}
expression
fn(expr$0) =>
  match $0 {
    #record(fields$1) =>
      match @core.equal(left: @core.list-length(value: $1), right: 2) {
        false =>
          #none,
        true =>
          match @definy.record-literal-field(fields: $1, key: "language", index: 0) {
            #none(_) =>
              #none,
            #some(language$2) =>
              match @definy.record-literal-field(fields: $1, key: "text", index: 0) {
                #none(_) =>
                  #none,
                #some(text$3) =>
                  match @definy.string-literal(expr: $2) {
                    #none(_) =>
                      #none,
                    #some(language_value$4) =>
                      match @definy.string-literal(expr: $3) {
                        #none(_) =>
                          #none,
                        #some(text_value$5) =>
                          #some({language: $4, text: $5})
                      }
                  }
              }
          }
      },
    _ =>
      #none
  }
visibility
public
definy.localized-text-literal (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: Q_bTa4tMOPoP7Hk1T8HI5FPDe9vJ4K_PkJ5y7tsIUxg
content hash: woA35KBrhPkSPXVo8pFFzGpAL7Gbqh7cLDAVx14W_-8