Pattern matching on structs causes TyckerException
See original GitHub issueCommit: beca413
open data Bool : Set | true | false
struct BoolPair : Set
| fst : Bool
| snd : Bool
open data U2 (x : BoolPair) : Set
| (false, false) => zero
| (false, true) => one
| (true, false) => two
| (true, true) => three
def not2 (x : BoolPair) : BoolPair
| (false, false) => (true, true)
| (false, true) => (true, false)
| (true, false) => (false, true)
| (true, true) => (false, false)
Both the data and the function definition cause the exception.
I don’t really know the syntax for pattern matching on structs, so I could only guess it’s the same as tuples as in Arend. Replace the parentheses with braces and the issue still occurs.
Judging from the source code, tycking for tuple patterns is not yet completed?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Strange result of pattern matching on structs #7156 - GitHub
. This Erlang AST is returning true on a match with a struct var due to the [True] body element, whereas we want...
Read more >Pattern matching inside of struct - rust - Stack Overflow
I am trying to swap value of the struct as an exercise (I know mem::swap exists). Swapping means matching a value of the...
Read more >All the Pattern Syntax - The Rust Programming Language
This code creates the variables x and y that match the x and y of the p variable. The outcome is that the...
Read more >Struct pattern matching - Questions / Help - Elixir Forum
I would like to pattern match both structs at once, based on the fact they share similar attributes: :id and :description .
Read more >Pattern Syntax - The Rust Programming Language
This code creates the variables a and b that match the values of the x and y fields of the p struct. This...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This isn’t possible in data definitions…