on 116a5a8 help sign in
ormolu/data/examples/declaration/value/function/transform-comprehensions.hs
55 lines 857 B history raw
1{-# LANGUAGE TransformListComp #-}
3foo xs ys = [(x, y) | x <- xs, y <- ys, then reverse]
5foo' xs ys = [
6 (x,
7 y) |
8 x <- xs,
9 y <- ys,
10 then -- First comment
11 reverse -- Second comment
12 ]
14bar xs ys = [(x, y) | x <- xs, y <- ys, then sortWith by (x + y)]
16bar' xs ys = [
17 (x,
18 y) |
19 x <- xs,
20 y <- ys,
21 then -- First comment
22 sortWith
23 by
24 (x
25 + y) -- Second comment
26 ]
28baz xs ys = [(x, y) | x <- xs, y <- ys, then group using permutations]
30baz' xs ys = [
31 (x,
32 y) |
33 x <- xs,
34 y <- ys,
35 then
36 group
37 using -- First comment
38 permutations -- Second comment
39 ]
41quux xs ys = [(x, y) | x <- xs, y <- ys, then group by (x + y) using groupWith]
43quux' xs ys = [
44 (x,
45 y) |
46 x <- xs,
47 y <- ys,
48 then
49 group
50 by -- First comment
51 (x
52 + y)
53 using -- Second comment
54 groupWith -- Third comment
55 ]