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
37
38
39
40
41
42
43
44
45
46
47
|
module Check.AST.Pattern.ConstFunc where
import Curry.SpanInfo
import Curry.Span
import Curry.Position
import Curry.Types
import Curry.Ident
import Text.Pretty
import Types
checkConstFunc :: Expression a -> Int -> CSM ()
checkConstFunc e _ =
case e of
(Lambda
sI
[ (VariablePattern _ _ ident1)
, (VariablePattern _ _ ident2)]
(Variable _ _ (QualIdent _ _ ident3))) -> do whenM (ident1 == ident3)
(report ( Message
(getSpan sI)
( text "superfluous code"
<+> colorizeKey "\\x y -> x"
)
( text "instead of"
<+> colorizeKey "\\x y -> x"
<+> text "write"
<+> colorizeKey "const"
)
)
)
whenM (ident3 == ident2)
(report ( Message
(getSpan sI)
( text "superfluous code"
<+> colorizeKey "\\x y -> y"
)
( text "instead of"
<+> colorizeKey "\\x y -> y"
<+> text "write"
<+> colorizeKey "const"
<+> text "and switch parameters"
)
)
)
_ -> return ()
|