improve match result display simplifier

Sponsored-by: Dartmouth College's DANDI project
This commit is contained in:
Joey Hess 2023-07-26 15:28:57 -04:00
parent 70de4a7e6d
commit 08071a1b90
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -242,6 +242,12 @@ describeMatchResult descop l prefix = Just $
-- (foo and bar) and baz => foo and bar and baz
simplify _ (MatchedOpen:o1@(MatchedOperation {}):MatchedAnd:o2@(MatchedOperation {}):MatchedClose:MatchedAnd:rest) =
o1:MatchedAnd:o2:MatchedAnd:simplify False rest
-- or (foo) => or foo
simplify _ (MatchedOr:MatchedOpen:o@(MatchedOperation {}):MatchedClose:rest) =
MatchedOr:o:simplify False rest
-- and (foo) => and foo
simplify _ (MatchedAnd:MatchedOpen:o@(MatchedOperation {}):MatchedClose:rest) =
MatchedAnd:o:simplify False rest
-- (not foo) => not foo
simplify _ (MatchedOpen:MatchedNot:o@(MatchedOperation {}):MatchedClose:rest) =
MatchedNot:o:simplify False rest