Skip to content

Conversation

b-studios
Copy link
Collaborator

This is a first attempt to implement or patterns (such as requested by #805).

It also supports nested or patterns, but exhaustivity is not yet implemented.

@b-studios b-studios marked this pull request as draft July 14, 2025 10:51
@b-studios
Copy link
Collaborator Author

Please note that this generates code (after inlining) such as

      if (infixEq_85("c", "a")) {
        let tmp_1303570 = println_1("hello")
        l_1303481(tmp_1303570)
      } else {
        if (infixEq_85("c", "b")) {
          let tmp_1303572 = println_1("hello")
          l_1303481(tmp_1303572)
        } else {
          let tmp_1303573 = println_1("world")
          l_1303481(tmp_1303573)
        }
      }

while the following would be better (for sharing code)

      if (infixEq_85("c", "a") || infixEq_85("c", "b")) {
        let tmp_1303570 = println_1("hello")
        l_1303481(tmp_1303570)
      } else {
        let tmp_1303573 = println_1("world")
        l_1303481(tmp_1303573)
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant