question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pattern matching on structs causes TyckerException

See original GitHub issue

Commit: 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:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
refparocommented, Aug 28, 2021

…you need to pattern match on x.fst, x.snd, etc.

This isn’t possible in data definitions…

0reactions
ice1000commented, Aug 28, 2021

…you need to pattern match on x.fst, x.snd, etc.

This isn’t possible in data definitions…

open data U2Impl (x y : Bool) : Set
  | false, false => zero
  | false, true => one
  | true, false => two
  | true, true => three

def U2 (x : BoolPair) => U2Impl x.fst x.snd
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found