diff options
Diffstat (limited to 'Utility/Matcher.hs')
-rw-r--r-- | Utility/Matcher.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Utility/Matcher.hs b/Utility/Matcher.hs index 19a77201c..d78e597dc 100644 --- a/Utility/Matcher.hs +++ b/Utility/Matcher.hs @@ -27,6 +27,7 @@ module Utility.Matcher ( matchM, matchMrun, isEmpty, + combineMatchers, prop_matcher_sane ) where @@ -142,6 +143,14 @@ isEmpty :: Matcher a -> Bool isEmpty MAny = True isEmpty _ = False +{- Combines two matchers, yielding a matcher that will match anything + - both do. -} +combineMatchers :: Matcher a -> Matcher a -> Matcher a +combineMatchers a b + | isEmpty a = b + | isEmpty b = a + | otherwise = a `MOr` b + prop_matcher_sane :: Bool prop_matcher_sane = all (\m -> match dummy m ()) $ map generate [ [Operation True] |