Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern not exhaustive in findTransition #2

Closed
keuhdall opened this issue May 27, 2018 · 1 comment
Closed

Pattern not exhaustive in findTransition #2

keuhdall opened this issue May 27, 2018 · 1 comment

Comments

@keuhdall
Copy link
Owner

A non exhaustive pattern causes the program to crash with unary_add.json and 111+11= as input.
The function causing the bug is findTransition (line 116).
(See code below ) :

findTransition :: String -> [Cond] -> Cond
findTransition w ts = case ts of
  (t:nts) -> if (read t) == w then t else (findTransition w nts)

Appart from the non exhaustive pattern problem, another part of the issue seems to come from the input itself, as the JSON does not implement the = sign and no transition leads to the HALT state.

@keuhdall
Copy link
Owner Author

keuhdall commented Jun 7, 2018

Fixed in commit 1e7116f

@keuhdall keuhdall closed this as completed Jun 7, 2018
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

No branches or pull requests

1 participant