Skip to content

Compiler doesn't recognize that patterns are exhaustively covered if using guards #4314

Closed Answered by lpil
ardauzan asked this question in Questions & support
Discussion options

You must be logged in to vote

This isn't a Gleam limitation! Performing exhaustive checking on arbitrary boolean expressions is an unsolved problem in computer science.

In your example there the guard is redundant and wasted computation, so it can be safely removed.

The limited set of guard expressions is a virtual machine design choice, motivated by performance characteristics. If Erlang supports more in future we will also support the new additions.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ardauzan
Comment options

Answer selected by ardauzan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants