-
Notifications
You must be signed in to change notification settings - Fork 8
/
SkipMatches.hs
36 lines (30 loc) · 1.39 KB
/
SkipMatches.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{-# LANGUAGE LambdaCase #-}
{-# OPTIONS_GHC -Wno-overlapping-patterns #-}
module SkipMatches where
-- See also issue #130
skipEquation :: Bool -> Bool
skipEquation True = False
skipEquation False = True
skipEquation _ = True -- This underscore case is redundant and needs to be eliminated
skipEquationMultipleArgs :: Bool -> Bool -> Bool
skipEquationMultipleArgs True _ = False
skipEquationMultipleArgs False _ = True
skipEquationMultipleArgs _ True = True -- This case is redundant and needs to be eliminated
skipEquationMultipleArgs _ False = False -- This case is redundant and needs to be eliminated
skipCasePattern :: Bool -> Bool
skipCasePattern b = case b of
True -> False
False -> True
_ -> True -- This underscore case is redundant and needs to be eliminated (locally)
ignore -> True -- This variable case is redundant and needs to be eliminated (globally)
skipLambdaCasePattern :: Bool -> Bool
skipLambdaCasePattern = \case
True -> False
False -> True
_ -> True -- This underscore case is redundant and needs to be eliminated (locally)
ignore -> True -- This variable case is redundant and needs to be eliminated (globally)
preserveCasePattern :: Bool -> Bool
preserveCasePattern = \case
True -> False
_ -> True -- This underscore case is NOT redundant
ignore -> True -- This variable case is redundant and needs to be eliminated (globally)