Skip to content

Commit

Permalink
Invariants: fix incomplete pattern match warning
Browse files Browse the repository at this point in the history
9.4.x seems to flag an incomplete pattern match where other ghc
versions don't. Replacing the initial pattern guard match against an
empty list with a final otherwise pattern guard clause silences it
relatively intuitively. The semantics should be preserved as the use
of the pattern guard match in testCompileToQuery is equivalent to case.

Compile-tested against 9.8.1, 9.6.2, 9.4.5, 9.2.8 and 8.10.7.
  • Loading branch information
NadiaYvette committed Nov 23, 2023
1 parent 68e6b21 commit 71c7473
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/Invariants.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ testCompileToQuery p = case fst $ compileToQuery p of
-- Handle special case for selectAll queries...
SelectAllQuery x -> [x] == vars p && numNonVarPatterns p == 0
q@(Query _ atoms)
| [] <- queryHeadVars q -> False
| _:xs <- queryHeadVars q ->
L.sort xs == L.sort (vars p)
&& length atoms == numNonVarPatterns p
| otherwise -> False
where
numNonVarPatterns :: Foldable lang => Pattern lang -> Int
numNonVarPatterns (VariablePattern _) = 0
Expand Down

0 comments on commit 71c7473

Please sign in to comment.