Skip to content

Commit d2b7c52

Browse files
authored
Merge pull request #662 from robx/bracket
Add failing test for brackets / slice ($x)
2 parents 925c6eb + d5c799b commit d2b7c52

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/Hint/Bracket.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ no = \(x -> y) -> z
2222
yes = (`foo` (bar baz)) -- @Suggestion (`foo` bar baz)
2323
yes = f ((x)) -- @Warning x
2424
main = do f; (print x) -- @Suggestion do f print x
25+
yes = f (x) y -- @Warning x
26+
no = f (+x) y
27+
no = f ($x) y
28+
no = ($x)
29+
yes = (($x)) -- @Warning ($x)
30+
no = ($1)
31+
yes = (($1)) -- @Warning ($1)
32+
no = (+5)
33+
yes = ((+5)) -- @Warning (+5)
2534
2635
-- type bracket reduction
2736
foo :: (Int -> Int) -> Int

tests/bracket.test

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---------------------------------------------------------------------
2+
RUN tests/bracket-slice.hs
3+
FILE tests/bracket-slice.hs
4+
5+
fAnd :: [a -> Bool] -> a -> Bool
6+
fAnd fs x = all ($x) fs
7+
8+
OUTPUT
9+
No hints
10+
11+
---------------------------------------------------------------------
12+
RUN tests/bracket-slice-spaced.hs
13+
FILE tests/bracket-slice-spaced.hs
14+
15+
fAnd :: [a -> Bool] -> a -> Bool
16+
fAnd fs x = all ($ x) fs
17+
18+
OUTPUT
19+
No hints
20+
21+
---------------------------------------------------------------------
22+
RUN tests/bracket-slice-plus.hs
23+
FILE tests/bracket-slice-plus.hs
24+
25+
incAll :: [Int] -> Int -> [Int]
26+
incAll ys x = map (+x) fs
27+
28+
OUTPUT
29+
No hints

0 commit comments

Comments
 (0)