on master help sign in
Split large examples
9a1f5ebUtku Demir
data/examples/declaration/class/associated-data1-out.hsnew file+14
@@ -0,0 +1,14 @@
1+{-# LANGUAGE TypeFamilies #-}
2+
3+class Foo a where data FooBar a
4+
5+-- | Something.
6+class Bar a where
7+
8+ -- | Bar bar
9+ data BarBar a
10+
11+ -- | Bar baz
12+ data
13+ BarBaz
14+ a
data/examples/declaration/class/associated-data1.hsnew file+12
@@ -0,0 +1,12 @@
1+{-# LANGUAGE TypeFamilies #-}
2+
3+class Foo a where data FooBar a
4+
5+-- | Something.
6+class Bar a
7+ where
8+ -- | Bar bar
9+ data BarBar a
10+ -- | Bar baz
11+ data family BarBaz
12+ a
data/examples/declaration/class/associated-data-out.hs → data/examples/declaration/class/associated-data2-out.hsrenamed−13
@@ -1,18 +1,5 @@
1{-# LANGUAGE TypeFamilies #-}
1{-# LANGUAGE TypeFamilies #-}
2
2
3−class Foo a where data FooBar a
4−
5−-- | Something.
6−class Bar a where
7−
8− -- | Bar bar
9− data BarBar a
10−
11− -- | Bar baz
12− data
13− BarBaz
14− a
15−
16-- | Something more.
3-- | Something more.
17class Baz a where
4class Baz a where
18
5
data/examples/declaration/class/associated-data.hs → data/examples/declaration/class/associated-data2.hsrenamed−11
@@ -1,16 +1,5 @@
1{-# LANGUAGE TypeFamilies #-}
1{-# LANGUAGE TypeFamilies #-}
2
2
3−class Foo a where data FooBar a
4−
5−-- | Something.
6−class Bar a
7− where
8− -- | Bar bar
9− data BarBar a
10− -- | Bar baz
11− data family BarBaz
12− a
13−
14-- | Something more.
3-- | Something more.
15class Baz a where
4class Baz a where
16 -- | Baz bar
5 -- | Baz bar
data/examples/declaration/class/associated-types1-out.hsnew file+14
@@ -0,0 +1,14 @@
1+{-# LANGUAGE TypeFamilies #-}
2+
3+class Foo a where type FooBar a
4+
5+-- | Something.
6+class Bar a where
7+
8+ -- | Bar bar
9+ type BarBar a
10+
11+ -- | Bar baz
12+ type
13+ BarBaz
14+ a
data/examples/declaration/class/associated-types1.hsnew file+12
@@ -0,0 +1,12 @@
1+{-# LANGUAGE TypeFamilies #-}
2+
3+class Foo a where type FooBar a
4+
5+-- | Something.
6+class Bar a
7+ where
8+ -- | Bar bar
9+ type BarBar a
10+ -- | Bar baz
11+ type BarBaz
12+ a
data/examples/declaration/class/associated-types-out.hs → data/examples/declaration/class/associated-types2-out.hsrenamed−13
@@ -1,18 +1,5 @@
1{-# LANGUAGE TypeFamilies #-}
1{-# LANGUAGE TypeFamilies #-}
2
2
3−class Foo a where type FooBar a
4−
5−-- | Something.
6−class Bar a where
7−
8− -- | Bar bar
9− type BarBar a
10−
11− -- | Bar baz
12− type
13− BarBaz
14− a
15−
16-- | Something more.
3-- | Something more.
17class Baz a where
4class Baz a where
18
5
data/examples/declaration/class/associated-types.hs → data/examples/declaration/class/associated-types2.hsrenamed−11
@@ -1,16 +1,5 @@
1{-# LANGUAGE TypeFamilies #-}
1{-# LANGUAGE TypeFamilies #-}
2
2
3−class Foo a where type FooBar a
4−
5−-- | Something.
6−class Bar a
7− where
8− -- | Bar bar
9− type BarBar a
10− -- | Bar baz
11− type BarBaz
12− a
13−
14-- | Something more.
3-- | Something more.
15class Baz a where
4class Baz a where
16 -- | Baz bar
5 -- | Baz bar
data/examples/declaration/class/default-implementations-comments-out.hsnew file+25
@@ -0,0 +1,25 @@
1+-- | Baz
2+class Baz a where
3+
4+ foobar :: a -> a
5+ foobar a =
6+ barbaz (bazbar a)
7+
8+ -- | Bar baz
9+ barbaz
10+ :: a -> a
11+
12+ -- | Baz bar
13+ bazbar
14+ :: a
15+ -> a
16+
17+ -- First comment
18+ barbaz a =
19+ bazbar -- Middle comment
20+ a
21+
22+ -- Last comment
23+ bazbar a =
24+ barbaz
25+ a
data/examples/declaration/class/default-implementations-comments.hsnew file+20
@@ -0,0 +1,20 @@
1+-- | Baz
2+class Baz a where
3+ foobar :: a -> a
4+ foobar a =
5+ barbaz (bazbar a)
6+ -- | Bar baz
7+ barbaz ::
8+ a -> a
9+ -- | Baz bar
10+ bazbar ::
11+ a ->
12+ a
13+ -- First comment
14+ barbaz a
15+ = bazbar -- Middle comment
16+ a
17+ -- Last comment
18+ bazbar a
19+ = barbaz
20+ a
data/examples/declaration/class/default-implementations-out.hs−26
@@ -11,29 +11,3 @@ class Bar a where
11 :: a
11 :: a
12 -> Int
12 -> Int
13 bar = const 0
13 bar = const 0
14−
15−-- | Baz
16−class Baz a where
17−
18− foobar :: a -> a
19− foobar a =
20− barbaz (bazbar a)
21−
22− -- | Bar baz
23− barbaz
24− :: a -> a
25−
26− -- | Baz bar
27− bazbar
28− :: a
29− -> a
30−
31− -- First comment
32− barbaz a =
33− bazbar -- Middle comment
34− a
35−
36− -- Last comment
37− bazbar a =
38− barbaz
39− a
data/examples/declaration/class/default-implementations.hs−20
@@ -10,23 +10,3 @@ class Bar a where
10 -> Int
10 -> Int
11 bar = const 0
11 bar = const 0
12
12
13−-- | Baz
14−class Baz a where
15− foobar :: a -> a
16− foobar a =
17− barbaz (bazbar a)
18− -- | Bar baz
19− barbaz ::
20− a -> a
21− -- | Baz bar
22− bazbar ::
23− a ->
24− a
25− -- First comment
26− barbaz a
27− = bazbar -- Middle comment
28− a
29− -- Last comment
30− bazbar a
31− = barbaz
32− a
data/examples/declaration/class/default-signatures-out.hs−9
@@ -1,14 +1,5 @@
1{-# LANGUAGE DefaultSignatures #-}
1{-# LANGUAGE DefaultSignatures #-}
2
2
3−-- | Something.
4−class Foo a where
5−
6− -- | Foo
7− foo :: a -> String
8−
9− default foo :: Show a => a -> String
10− foo = show
11−
12-- | Something else.
3-- | Something else.
13class Bar a where
4class Bar a where
14
5
data/examples/declaration/class/default-signatures-simple-out.hsnew file+8
@@ -0,0 +1,8 @@
1+-- | Something.
2+class Foo a where
3+
4+ -- | Foo
5+ foo :: a -> String
6+
7+ default foo :: Show a => a -> String
8+ foo = show
data/examples/declaration/class/default-signatures-simple.hsnew file+7
@@ -0,0 +1,7 @@
1+-- | Something.
2+class Foo a where
3+ -- | Foo
4+ foo :: a -> String
5+ default foo :: Show a => a -> String
6+ foo = show
7+
data/examples/declaration/class/default-signatures.hs−7
@@ -1,12 +1,5 @@
1{-# LANGUAGE DefaultSignatures #-}
1{-# LANGUAGE DefaultSignatures #-}
2
2
3−-- | Something.
4−class Foo a where
5− -- | Foo
6− foo :: a -> String
7− default foo :: Show a => a -> String
8− foo = show
9−
10-- | Something else.
3-- | Something else.
11class Bar a
4class Bar a
12 where
5 where
data/examples/declaration/class/multi-parameters1-out.hsnew file+17
@@ -0,0 +1,17 @@
1+{-# LANGUAGE MultiParamTypeClasses #-}
2+
3+class Foo a b where foo :: a -> b
4+
5+-- | Something.
6+class Bar a b c d where
7+
8+ bar
9+ :: a
10+ -> b
11+ -> c
12+ -> d
13+
14+class -- Before name
15+ Baz where
16+
17+ baz :: Int
data/examples/declaration/class/multi-parameters1.hsnew file+18
@@ -0,0 +1,18 @@
1+{-# LANGUAGE MultiParamTypeClasses #-}
2+
3+class Foo a b where foo :: a -> b
4+
5+-- | Something.
6+class Bar a b c d
7+ where
8+ bar ::
9+ a
10+ -> b
11+ -> c
12+ -> d
13+
14+class -- Before name
15+ Baz
16+ where
17+ baz :: Int
18+
data/examples/declaration/class/multi-parameters-out.hs → data/examples/declaration/class/multi-parameters2-out.hsrenamed−16
@@ -1,21 +1,5 @@
1{-# LANGUAGE MultiParamTypeClasses #-}
1{-# LANGUAGE MultiParamTypeClasses #-}
2
2
3−class Foo a b where foo :: a -> b
4−
5−-- | Something.
6−class Bar a b c d where
7−
8− bar
9− :: a
10− -> b
11− -> c
12− -> d
13−
14−class -- Before name
15− Baz where
16−
17− baz :: Int
18−
19-- | Something else.
3-- | Something else.
20class
4class
21 BarBaz
5 BarBaz
data/examples/declaration/class/multi-parameters.hs → data/examples/declaration/class/multi-parameters2.hsrenamed−16
@@ -1,21 +1,5 @@
1{-# LANGUAGE MultiParamTypeClasses #-}
1{-# LANGUAGE MultiParamTypeClasses #-}
2
2
3−class Foo a b where foo :: a -> b
4−
5−-- | Something.
6−class Bar a b c d
7− where
8− bar ::
9− a
10− -> b
11− -> c
12− -> d
13−
14−class -- Before name
15− Baz
16− where
17− baz :: Int
18−
19-- | Something else.
3-- | Something else.
20class
4class
21 BarBaz
5 BarBaz
data/examples/declaration/class/type-operators-out.hsdeleted−43
@@ -1,43 +0,0 @@
1−{-# LANGUAGE MultiParamTypeClasses #-}
2−{-# LANGUAGE TypeOperators #-}
3−
4−class (:$) a b
5−
6−class
7− (:&)
8− a
9− b
10−
11−class a :* b
12−
13−class
14− a -- Before operator
15− :+ b -- After operator
16−
17−class
18− ( f
19− :. g
20− )
21− a
22−
23−class a `Pair` b
24−
25−class
26− a
27− `Sum` b
28−
29−class (f `Product` g) a
30−
31−class
32− ( f
33− `Sum` g
34− )
35− a
36−
37−type API
38− = "route1" :> ApiRoute1
39− :<|> "route2"
40− :> ApiRoute2 -- comment here
41− :<|> OmitDocs
42− :> "i"
43− :> ASomething API
data/examples/declaration/class/type-operators.hsdeleted−39
@@ -1,39 +0,0 @@
1−{-# LANGUAGE MultiParamTypeClasses #-}
2−{-# LANGUAGE TypeOperators #-}
3−
4−class (:$) a b
5−
6−class (:&)
7− a
8− b
9−
10−class a:*b
11−
12−class
13− a -- Before operator
14− :+
15− b -- After operator
16−
17−class (
18− f :. g
19− ) a
20−
21−class
22− a`Pair`b
23−
24−class
25− a
26− `Sum` b
27−
28−class (f`Product`g)a
29−
30−class (
31− f `Sum` g
32− ) a
33−
34−type API
35− = "route1" :> ApiRoute1
36− :<|> "route2" :> ApiRoute2 -- comment here
37− :<|> OmitDocs :> "i" :> ASomething API
38−
39−
data/examples/declaration/class/type-operators1-out.hsnew file+21
@@ -0,0 +1,21 @@
1+{-# LANGUAGE MultiParamTypeClasses #-}
2+{-# LANGUAGE TypeOperators #-}
3+
4+class (:$) a b
5+
6+class
7+ (:&)
8+ a
9+ b
10+
11+class a :* b
12+
13+class
14+ a -- Before operator
15+ :+ b -- After operator
16+
17+class
18+ ( f
19+ :. g
20+ )
21+ a
data/examples/declaration/class/type-operators1.hsnew file+19
@@ -0,0 +1,19 @@
1+{-# LANGUAGE MultiParamTypeClasses #-}
2+{-# LANGUAGE TypeOperators #-}
3+
4+class (:$) a b
5+
6+class (:&)
7+ a
8+ b
9+
10+class a:*b
11+
12+class
13+ a -- Before operator
14+ :+
15+ b -- After operator
16+
17+class (
18+ f :. g
19+ ) a
data/examples/declaration/class/type-operators2-out.hsnew file+16
@@ -0,0 +1,16 @@
1+{-# LANGUAGE MultiParamTypeClasses #-}
2+{-# LANGUAGE TypeOperators #-}
3+
4+class a `Pair` b
5+
6+class
7+ a
8+ `Sum` b
9+
10+class (f `Product` g) a
11+
12+class
13+ ( f
14+ `Sum` g
15+ )
16+ a
data/examples/declaration/class/type-operators2.hsnew file+16
@@ -0,0 +1,16 @@
1+{-# LANGUAGE MultiParamTypeClasses #-}
2+{-# LANGUAGE TypeOperators #-}
3+
4+class
5+ a`Pair`b
6+
7+class
8+ a
9+ `Sum` b
10+
11+class (f`Product`g)a
12+
13+class (
14+ f `Sum` g
15+ ) a
16+
data/examples/declaration/deriving/multiline-out.hs−20
@@ -14,26 +14,6 @@ deriving newtype instance
14 Data
14 Data
15 Foo
15 Foo
16
16
17−deriving instance
18− {-# OVERLAPPABLE #-}
19− Ord
20− Foo
21−
22−deriving instance
23− {-# OVERLAPPING #-}
24− Num
25− Foo
26−
27−deriving instance
28− {-# OVERLAPS #-}
29− Read
30− Foo
31−
32−deriving instance
33− {-# INCOHERENT #-}
34− Show
35− Foo
36−
37deriving via
17deriving via
38 Foo
18 Foo
39 Int
19 Int
data/examples/declaration/deriving/multiline.hs−17
@@ -11,23 +11,6 @@ deriving newtype instance
11 Data
11 Data
12 Foo
12 Foo
13
13
14−deriving instance
15− {-# OVERLAPPABLE #-}
16− Ord
17− Foo
18−deriving instance
19− {-# OVERLAPPING #-}
20− Num
21− Foo
22−deriving instance
23− {-# OVERLAPS #-}
24− Read
25− Foo
26−deriving instance
27− {-# INCOHERENT #-}
28− Show
29− Foo
30−
31deriving via Foo
14deriving via Foo
32 Int
15 Int
33 instance Triple
16 instance Triple
data/examples/declaration/deriving/overlapping-out.hsnew file+19
@@ -0,0 +1,19 @@
1+deriving instance
2+ {-# OVERLAPPABLE #-}
3+ Ord
4+ Foo
5+
6+deriving instance
7+ {-# OVERLAPPING #-}
8+ Num
9+ Foo
10+
11+deriving instance
12+ {-# OVERLAPS #-}
13+ Read
14+ Foo
15+
16+deriving instance
17+ {-# INCOHERENT #-}
18+ Show
19+ Foo
data/examples/declaration/deriving/overlapping.hsnew file+17
@@ -0,0 +1,17 @@
1+deriving instance
2+ {-# OVERLAPPABLE #-}
3+ Ord
4+ Foo
5+deriving instance
6+ {-# OVERLAPPING #-}
7+ Num
8+ Foo
9+deriving instance
10+ {-# OVERLAPS #-}
11+ Read
12+ Foo
13+deriving instance
14+ {-# INCOHERENT #-}
15+ Show
16+ Foo
17+
data/examples/declaration/instance/contexts-comments-out.hsnew file+18
@@ -0,0 +1,18 @@
1+instance
2+ ( Read a, -- Foo
3+ Read b,
4+ Read
5+ ( c, -- Bar
6+ d
7+ )
8+ )
9+ => Read
10+ ( a, -- Baz
11+ b,
12+ ( c, -- Quux
13+ d
14+ )
15+ )
16+ where
17+
18+ readsPrec = undefined
data/examples/declaration/instance/contexts-comments.hsnew file+18
@@ -0,0 +1,18 @@
1+instance (
2+ Read a, -- Foo
3+ Read b
4+ , Read (
5+ c, -- Bar
6+ d
7+ )
8+ )
9+ =>
10+ Read (
11+ a, -- Baz
12+ b
13+ ,(
14+ c, -- Quux
15+ d
16+ )
17+ ) where
18+ readsPrec = undefined
data/examples/declaration/instance/contexts-out.hs−19
@@ -18,22 +18,3 @@ instance
18 where
18 where
19
19
20 showsPrec _ _ = showString ""
20 showsPrec _ _ = showString ""
21−
22−instance
23− ( Read a, -- Foo
24− Read b,
25− Read
26− ( c, -- Bar
27− d
28− )
29− )
30− => Read
31− ( a, -- Baz
32− b,
33− ( c, -- Quux
34− d
35− )
36− )
37− where
38−
39− readsPrec = undefined
data/examples/declaration/instance/contexts.hs−19
@@ -12,22 +12,3 @@ instance (Show a, Show b) =>
12 b
12 b
13 ) where
13 ) where
14 showsPrec _ _ = showString ""
14 showsPrec _ _ = showString ""
15−
16−instance (
17− Read a, -- Foo
18− Read b
19− , Read (
20− c, -- Bar
21− d
22− )
23− )
24− =>
25− Read (
26− a, -- Baz
27− b
28− ,(
29− c, -- Quux
30− d
31− )
32− ) where
33− readsPrec = undefined
data/examples/declaration/instance/data-family-instances-gadt-out.hsnew file+11
@@ -0,0 +1,11 @@
1+{-# LANGUAGE GADTSyntax #-}
2+{-# LANGUAGE TypeFamilies #-}
3+
4+data instance Bar Int a where
5+ SameBar
6+ :: Bar Int
7+ Int
8+ CloseBar :: Bar Int Double
9+ OtherBar
10+ :: Bar Int
11+ a
data/examples/declaration/instance/data-family-instances-gadt.hsnew file+10
@@ -0,0 +1,10 @@
1+{-# LANGUAGE GADTSyntax #-}
2+{-# LANGUAGE TypeFamilies #-}
3+data instance Bar Int a where
4+ SameBar
5+ :: Bar Int
6+ Int
7+ CloseBar :: Bar Int Double
8+ OtherBar
9+ :: Bar Int
10+ a
data/examples/declaration/instance/data-family-instances-newtype-out.hsnew file+7
@@ -0,0 +1,7 @@
1+{-# LANGUAGE GADTSyntax #-}
2+{-# LANGUAGE TypeFamilies #-}
3+
4+newtype instance Foo [Double]
5+ = DoubleListFoo
6+ { unDoubleListFoo :: Double
7+ }
data/examples/declaration/instance/data-family-instances-newtype.hsnew file+6
@@ -0,0 +1,6 @@
1+{-# LANGUAGE GADTSyntax #-}
2+{-# LANGUAGE TypeFamilies #-}
3+newtype instance Foo [Double] = DoubleListFoo {
4+ unDoubleListFoo :: Double
5+}
6+
data/examples/declaration/instance/data-family-instances-out.hs−14
@@ -14,21 +14,7 @@ data instance
14 Double
14 Double
15 )
15 )
16
16
17−newtype instance Foo [Double]
18− = DoubleListFoo
19− { unDoubleListFoo :: Double
20− }
21−
22data instance Bar Double a
17data instance Bar Double a
23 = DoubleBar
18 = DoubleBar
24 Double
19 Double
25 (Bar a)
20 (Bar a)
26−
27−data instance Bar Int a where
28− SameBar
29− :: Bar Int
30− Int
31− CloseBar :: Bar Int Double
32− OtherBar
33− :: Bar Int
34− a
data/examples/declaration/instance/data-family-instances.hs−12
@@ -13,20 +13,8 @@ data instance
13 Double
13 Double
14 )
14 )
15
15
16−newtype instance Foo [Double] = DoubleListFoo {
17− unDoubleListFoo :: Double
18−}
19−
20data instance Bar Double a =
16data instance Bar Double a =
21 DoubleBar
17 DoubleBar
22 Double
18 Double
23 (Bar a)
19 (Bar a)
24
20
25−data instance Bar Int a where
26− SameBar
27− :: Bar Int
28− Int
29− CloseBar :: Bar Int Double
30− OtherBar
31− :: Bar Int
32− a
data/examples/declaration/instance/instance-sigs-multiple-out.hsnew file+12
@@ -0,0 +1,12 @@
1+{-# LANGUAGE InstanceSigs #-}
2+
3+instance Applicative [] where
4+
5+ pure
6+ :: a
7+ -> [a]
8+ pure a = [a]
9+
10+ (<*>)
11+ :: [a] -> [a] -> [a]
12+ (<*>) _ _ = []
data/examples/declaration/instance/instance-sigs-multiple.hsnew file+10
@@ -0,0 +1,10 @@
1+{-# LANGUAGE InstanceSigs #-}
2+
3+instance Applicative [] where
4+ pure ::
5+ a
6+ -> [a]
7+ pure a = [a]
8+ (<*>)
9+ :: [ a ] -> [ a ] -> [ a ]
10+ (<*>) _ _ = []
data/examples/declaration/instance/instance-sigs-out.hs−11
@@ -15,14 +15,3 @@ instance Ord Int where
15 _
15 _
16 _ =
16 _ =
17 GT
17 GT
18−
19−instance Applicative [] where
20−
21− pure
22− :: a
23− -> [a]
24− pure a = [a]
25−
26− (<*>)
27− :: [a] -> [a] -> [a]
28− (<*>) _ _ = []
data/examples/declaration/instance/instance-sigs.hs−9
@@ -14,12 +14,3 @@ instance Ord Int where
14 _
14 _
15 _
15 _
16 = GT
16 = GT
17−
18−instance Applicative [] where
19− pure ::
20− a
21− -> [a]
22− pure a = [a]
23− (<*>)
24− :: [ a ] -> [ a ] -> [ a ]
25− (<*>) _ _ = []
data/examples/declaration/rewrite-rule/basic1-out.hsnew file+18
@@ -0,0 +1,18 @@
1+{-# RULES
2+"fold/build" foldr k z (build g) = g k z
3+ #-}
4+
5+{-# RULES
6+"fusable/aux"
7+ fusable x (aux y) =
8+ faux x y
9+ #-}
10+
11+{-# RULES
12+"map/map"
13+ map f
14+ (map g xs) =
15+ map
16+ (f . g)
17+ xs
18+ #-}
data/examples/declaration/rewrite-rule/basic1.hsnew file+17
@@ -0,0 +1,17 @@
1+{-# RULES
2+"fold/build" foldr k z (build g) = g k z
3+ #-}
4+
5+{-# RULES
6+"fusable/aux"
7+ fusable x (aux y) = faux x y
8+ #-}
9+
10+{-# RULES
11+"map/map"
12+ map f
13+ (map g xs) = map
14+ (f . g)
15+ xs
16+ #-}
17+
data/examples/declaration/rewrite-rule/basic-out.hs → data/examples/declaration/rewrite-rule/basic2-out.hsrenamed−19
@@ -1,22 +1,3 @@
1−{-# RULES
2−"fold/build" foldr k z (build g) = g k z
3− #-}
4−
5−{-# RULES
6−"fusable/aux"
7− fusable x (aux y) =
8− faux x y
9− #-}
10−
11−{-# RULES
12−"map/map"
13− map f
14− (map g xs) =
15− map
16− (f . g)
17− xs
18− #-}
19−
20{-# RULES
1{-# RULES
21"++" xs ++ ys = augment (\c n -> foldr c n xs) ys
2"++" xs ++ ys = augment (\c n -> foldr c n xs) ys
22"concat" xs `concat` ys = augment (\c n -> foldr c n xs) ys
3"concat" xs `concat` ys = augment (\c n -> foldr c n xs) ys
data/examples/declaration/rewrite-rule/basic.hs → data/examples/declaration/rewrite-rule/basic2.hsrenamed−17
@@ -1,20 +1,3 @@
1−{-# RULES
2−"fold/build" foldr k z (build g) = g k z
3− #-}
4−
5−{-# RULES
6−"fusable/aux"
7− fusable x (aux y) = faux x y
8− #-}
9−
10−{-# RULES
11−"map/map"
12− map f
13− (map g xs) = map
14− (f . g)
15− xs
16− #-}
17−
18{-# RULES
1{-# RULES
19"++" xs ++ ys = augment (\c n -> foldr c n xs) ys
2"++" xs ++ ys = augment (\c n -> foldr c n xs) ys
20"concat" xs `concat` ys = augment (\c n -> foldr c n xs) ys
3"concat" xs `concat` ys = augment (\c n -> foldr c n xs) ys
data/examples/declaration/rewrite-rule/prelude-out.hsdeleted−74
@@ -1,74 +0,0 @@
1−{-# LANGUAGE MagicHash #-}
2−
3−{-# RULES
4−"map/map" forall f g xs. map f (map g xs) = map (f . g) xs
5−"map/append" forall f xs ys. map f (xs ++ ys) = map f xs ++ map f ys
6− #-}
7−
8−{-# RULES
9−"fold/build" forall k z (g :: forall b. (a -> b -> b) -> b -> b).
10− foldr k z (build g) =
11− g k z
12−"foldr/augment" forall k z xs (g :: forall b. (a -> b -> b) -> b -> b).
13− foldr k z (augment g xs) =
14− g k (foldr k z xs)
15−"foldr/id" foldr (:) [] = \x -> x
16−"foldr/app" [1] forall ys. foldr (:) ys = \xs -> xs ++ ys
17−-- Only activate this from phase 1, because that's
18−-- when we disable the rule that expands (++) into foldr
19−
20−-- The foldr/cons rule looks nice, but it can give disastrously
21−-- bloated code when commpiling
22−-- array (a,b) [(1,2), (2,2), (3,2), ...very long list... ]
23−-- i.e. when there are very very long literal lists
24−-- So I've disabled it for now. We could have special cases
25−-- for short lists, I suppose.
26−-- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs)
27−"foldr/single" forall k z x. foldr k z [x] = k x z
28−"foldr/nil" forall k z. foldr k z [] = z
29−"augment/build" forall
30− (g :: forall b. (a -> b -> b) -> b -> b)
31− (h :: forall b. (a -> b -> b) -> b -> b).
32− augment g (build h) =
33− build (\c n -> g c (h c n))
34−"augment/nil" forall (g :: forall b. (a -> b -> b) -> b -> b).
35− augment g [] =
36− build g
37− #-}
38−
39−{-# RULES
40−"map" [~1] forall f xs. map f xs = build (\c n -> foldr (mapFB c f) n xs)
41−"mapList" [1] forall f. foldr (mapFB (:) f) [] = map f
42−"mapFB" forall c f g. mapFB (mapFB c f) g = mapFB c (f . g)
43− #-}
44−
45−{-# RULES
46−"map/map" [~2] forall f g xs.
47− map f (map g xs) =
48− map (f . g) xs
49−"f" op True y = False
50−"g" op True y = False
51− #-}
52−
53−{-# RULES
54−"x# `eqChar#` x#" forall x#. x# `eqChar#` x# = True
55−"x# `neChar#` x#" forall x#. x# `neChar#` x# = False
56−"x# `gtChar#` x#" forall x#. x# `gtChar#` x# = False
57−"x# `geChar#` x#" forall x#. x# `geChar#` x# = True
58−"x# `leChar#` x#" forall x#. x# `leChar#` x# = True
59−"x# `ltChar#` x#" forall x#. x# `ltChar#` x# = False
60− #-}
61−
62−{-# RULES
63−"unpack" [~1] forall a. unpackCString# a = build (unpackFoldrCString# a)
64−"unpack-list" [1] forall a. unpackFoldrCString# a (:) [] = unpackCString# a
65−"unpack-append" forall a n. unpackFoldrCString# a (:) n = unpackAppendCString# a n
66−-- There's a built-in rule (in PrelRules.lhs) for
67−-- unpackFoldr "foo" c (unpackFoldr "baz" c n) = unpackFoldr "foobaz" c n
68− #-}
69−
70−{-# RULES
71−"foldr/build" forall f n (g :: forall b. (a -> b -> b) -> b -> b).
72− foldr f n (build g) =
73− g f n
74− #-}
data/examples/declaration/rewrite-rule/prelude.hsdeleted−73
@@ -1,73 +0,0 @@
1−{-# LANGUAGE MagicHash #-}
2−
3−{-# RULES
4−"map/map" forall f g xs. map f (map g xs) = map (f.g) xs
5−"map/append" forall f xs ys. map f (xs ++ ys) = map f xs ++ map f ys
6− #-}
7−
8−{-# RULES
9−"fold/build" forall k z (g::forall b. (a->b->b) -> b -> b) .
10− foldr k z (build g) = g k z
11−
12−"foldr/augment" forall k z xs (g::forall b. (a->b->b) -> b -> b) .
13− foldr k z (augment g xs) = g k (foldr k z xs)
14−
15−"foldr/id" foldr (:) [] = \x -> x
16−"foldr/app" [1] forall ys. foldr (:) ys = \xs -> xs ++ ys
17− -- Only activate this from phase 1, because that's
18− -- when we disable the rule that expands (++) into foldr
19−
20−-- The foldr/cons rule looks nice, but it can give disastrously
21−-- bloated code when commpiling
22−-- array (a,b) [(1,2), (2,2), (3,2), ...very long list... ]
23−-- i.e. when there are very very long literal lists
24−-- So I've disabled it for now. We could have special cases
25−-- for short lists, I suppose.
26−-- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs)
27−
28−"foldr/single" forall k z x. foldr k z [x] = k x z
29−"foldr/nil" forall k z. foldr k z [] = z
30−
31−"augment/build" forall (g::forall b. (a->b->b) -> b -> b)
32− (h::forall b. (a->b->b) -> b -> b) .
33− augment g (build h) = build (\c n -> g c (h c n))
34−"augment/nil" forall (g::forall b. (a->b->b) -> b -> b) .
35− augment g [] = build g
36− #-}
37−
38−{-# RULES
39−"map" [~1] forall f xs. map f xs = build (\c n -> foldr (mapFB c f) n xs)
40−"mapList" [1] forall f. foldr (mapFB (:) f) [] = map f
41−"mapFB" forall c f g. mapFB (mapFB c f) g = mapFB c (f.g)
42− #-}
43−
44−{-# RULES
45− "map/map" [~2] forall f g xs.
46− map f (map g xs) = map (f.g) xs; "f" op True y = False;
47− "g" op True y = False
48−#-}
49−
50−{-# RULES
51−"x# `eqChar#` x#" forall x#. x# `eqChar#` x# = True
52−"x# `neChar#` x#" forall x#. x# `neChar#` x# = False
53−"x# `gtChar#` x#" forall x#. x# `gtChar#` x# = False
54−"x# `geChar#` x#" forall x#. x# `geChar#` x# = True
55−"x# `leChar#` x#" forall x#. x# `leChar#` x# = True
56−"x# `ltChar#` x#" forall x#. x# `ltChar#` x# = False
57− #-}
58−
59−{-# RULES
60−"unpack" [~1] forall a . unpackCString# a = build (unpackFoldrCString# a)
61−"unpack-list" [1] forall a . unpackFoldrCString# a (:) [] = unpackCString# a
62−"unpack-append" forall a n . unpackFoldrCString# a (:) n = unpackAppendCString# a n
63−
64−-- There's a built-in rule (in PrelRules.lhs) for
65−-- unpackFoldr "foo" c (unpackFoldr "baz" c n) = unpackFoldr "foobaz" c n
66−
67− #-}
68−
69−{-# RULES
70− "foldr/build"
71− forall f n (g :: forall b. (a -> b -> b) -> b -> b).
72− foldr f n (build g) = g f n
73−#-}
data/examples/declaration/rewrite-rule/prelude1-out.hsnew file+18
@@ -0,0 +1,18 @@
1+{-# RULES
2+"map/map" forall f g xs. map f (map g xs) = map (f . g) xs
3+"map/append" forall f xs ys. map f (xs ++ ys) = map f xs ++ map f ys
4+ #-}
5+
6+{-# RULES
7+"map" [~1] forall f xs. map f xs = build (\c n -> foldr (mapFB c f) n xs)
8+"mapList" [1] forall f. foldr (mapFB (:) f) [] = map f
9+"mapFB" forall c f g. mapFB (mapFB c f) g = mapFB c (f . g)
10+ #-}
11+
12+{-# RULES
13+"map/map" [~2] forall f g xs.
14+ map f (map g xs) =
15+ map (f . g) xs
16+"f" op True y = False
17+"g" op True y = False
18+ #-}
data/examples/declaration/rewrite-rule/prelude1.hsnew file+17
@@ -0,0 +1,17 @@
1+{-# RULES
2+"map/map" forall f g xs. map f (map g xs) = map (f.g) xs
3+"map/append" forall f xs ys. map f (xs ++ ys) = map f xs ++ map f ys
4+ #-}
5+
6+{-# RULES
7+"map" [~1] forall f xs. map f xs = build (\c n -> foldr (mapFB c f) n xs)
8+"mapList" [1] forall f. foldr (mapFB (:) f) [] = map f
9+"mapFB" forall c f g. mapFB (mapFB c f) g = mapFB c (f.g)
10+ #-}
11+
12+{-# RULES
13+ "map/map" [~2] forall f g xs.
14+ map f (map g xs) = map (f.g) xs; "f" op True y = False;
15+ "g" op True y = False
16+#-}
17+
data/examples/declaration/rewrite-rule/prelude2-out.hsnew file+30
@@ -0,0 +1,30 @@
1+{-# RULES
2+"fold/build" forall k z (g :: forall b. (a -> b -> b) -> b -> b).
3+ foldr k z (build g) =
4+ g k z
5+"foldr/augment" forall k z xs (g :: forall b. (a -> b -> b) -> b -> b).
6+ foldr k z (augment g xs) =
7+ g k (foldr k z xs)
8+"foldr/id" foldr (:) [] = \x -> x
9+"foldr/app" [1] forall ys. foldr (:) ys = \xs -> xs ++ ys
10+-- Only activate this from phase 1, because that's
11+-- when we disable the rule that expands (++) into foldr
12+
13+-- The foldr/cons rule looks nice, but it can give disastrously
14+-- bloated code when commpiling
15+-- array (a,b) [(1,2), (2,2), (3,2), ...very long list... ]
16+-- i.e. when there are very very long literal lists
17+-- So I've disabled it for now. We could have special cases
18+-- for short lists, I suppose.
19+-- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs)
20+"foldr/single" forall k z x. foldr k z [x] = k x z
21+"foldr/nil" forall k z. foldr k z [] = z
22+"augment/build" forall
23+ (g :: forall b. (a -> b -> b) -> b -> b)
24+ (h :: forall b. (a -> b -> b) -> b -> b).
25+ augment g (build h) =
26+ build (\c n -> g c (h c n))
27+"augment/nil" forall (g :: forall b. (a -> b -> b) -> b -> b).
28+ augment g [] =
29+ build g
30+ #-}
data/examples/declaration/rewrite-rule/prelude2.hsnew file+30
@@ -0,0 +1,30 @@
1+{-# RULES
2+"fold/build" forall k z (g::forall b. (a->b->b) -> b -> b) .
3+ foldr k z (build g) = g k z
4+
5+"foldr/augment" forall k z xs (g::forall b. (a->b->b) -> b -> b) .
6+ foldr k z (augment g xs) = g k (foldr k z xs)
7+
8+"foldr/id" foldr (:) [] = \x -> x
9+"foldr/app" [1] forall ys. foldr (:) ys = \xs -> xs ++ ys
10+ -- Only activate this from phase 1, because that's
11+ -- when we disable the rule that expands (++) into foldr
12+
13+-- The foldr/cons rule looks nice, but it can give disastrously
14+-- bloated code when commpiling
15+-- array (a,b) [(1,2), (2,2), (3,2), ...very long list... ]
16+-- i.e. when there are very very long literal lists
17+-- So I've disabled it for now. We could have special cases
18+-- for short lists, I suppose.
19+-- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs)
20+
21+"foldr/single" forall k z x. foldr k z [x] = k x z
22+"foldr/nil" forall k z. foldr k z [] = z
23+
24+"augment/build" forall (g::forall b. (a->b->b) -> b -> b)
25+ (h::forall b. (a->b->b) -> b -> b) .
26+ augment g (build h) = build (\c n -> g c (h c n))
27+"augment/nil" forall (g::forall b. (a->b->b) -> b -> b) .
28+ augment g [] = build g
29+ #-}
30+
data/examples/declaration/rewrite-rule/prelude3-out.hsnew file+10
@@ -0,0 +1,10 @@
1+{-# LANGUAGE MagicHash #-}
2+
3+{-# RULES
4+"x# `eqChar#` x#" forall x#. x# `eqChar#` x# = True
5+"x# `neChar#` x#" forall x#. x# `neChar#` x# = False
6+"x# `gtChar#` x#" forall x#. x# `gtChar#` x# = False
7+"x# `geChar#` x#" forall x#. x# `geChar#` x# = True
8+"x# `leChar#` x#" forall x#. x# `leChar#` x# = True
9+"x# `ltChar#` x#" forall x#. x# `ltChar#` x# = False
10+ #-}
data/examples/declaration/rewrite-rule/prelude3.hsnew file+10
@@ -0,0 +1,10 @@
1+{-# LANGUAGE MagicHash #-}
2+
3+{-# RULES
4+"x# `eqChar#` x#" forall x#. x# `eqChar#` x# = True
5+"x# `neChar#` x#" forall x#. x# `neChar#` x# = False
6+"x# `gtChar#` x#" forall x#. x# `gtChar#` x# = False
7+"x# `geChar#` x#" forall x#. x# `geChar#` x# = True
8+"x# `leChar#` x#" forall x#. x# `leChar#` x# = True
9+"x# `ltChar#` x#" forall x#. x# `ltChar#` x# = False
10+ #-}
data/examples/declaration/rewrite-rule/prelude4-out.hsnew file+7
@@ -0,0 +1,7 @@
1+{-# RULES
2+"unpack" [~1] forall a. unpackCString # a = build (unpackFoldrCString # a)
3+"unpack-list" [1] forall a. unpackFoldrCString # a (:) [] = unpackCString # a
4+"unpack-append" forall a n. unpackFoldrCString # a (:) n = unpackAppendCString # a n
5+ #-}
6+-- There's a built-in rule (in PrelRules.lhs) for
7+-- unpackFoldr "foo" c (unpackFoldr "baz" c n) = unpackFoldr "foobaz" c n
data/examples/declaration/rewrite-rule/prelude4.hsnew file+9
@@ -0,0 +1,9 @@
1+{-# RULES
2+"unpack" [~1] forall a . unpackCString# a = build (unpackFoldrCString# a)
3+"unpack-list" [1] forall a . unpackFoldrCString# a (:) [] = unpackCString# a
4+"unpack-append" forall a n . unpackFoldrCString# a (:) n = unpackAppendCString# a n
5+
6+-- There's a built-in rule (in PrelRules.lhs) for
7+-- unpackFoldr "foo" c (unpackFoldr "baz" c n) = unpackFoldr "foobaz" c n
8+
9+ #-}
data/examples/declaration/role-annotation/multi-line-out.hsnew file+15
@@ -0,0 +1,15 @@
1+type role
2+ D
3+ phantom
4+ nominal
5+
6+type role
7+ E
8+ _
9+ nominal
10+
11+type role
12+ E
13+ _
14+ nominal
15+ phantom
data/examples/declaration/role-annotation/multi-line.hsnew file+15
@@ -0,0 +1,15 @@
1+type role
2+ D phantom nominal
3+
4+type
5+ role
6+ E
7+ _
8+ nominal
9+
10+type
11+ role
12+ E
13+ _
14+ nominal
15+ phantom
data/examples/declaration/role-annotation/simple-out.hs → data/examples/declaration/role-annotation/single-line-out.hsrenamed−16
@@ -8,19 +8,3 @@ type role A nominal nominal
8type role B _ phantom
8type role B _ phantom
9
9
10type role C _ _
10type role C _ _
11−
12−type role
13− D
14− phantom
15− nominal
16−
17−type role
18− E
19− _
20− nominal
21−
22−type role
23− E
24− _
25− nominal
26− phantom
data/examples/declaration/role-annotation/simple.hs → data/examples/declaration/role-annotation/single-line.hsrenamed−16
@@ -7,19 +7,3 @@ type role A nominal nominal
7
7
8type role B _ phantom
8type role B _ phantom
9type role C _ _
9type role C _ _
10−
11−type role
12− D phantom nominal
13−
14−type
15− role
16− E
17− _
18− nominal
19−
20−type
21− role
22− E
23− _
24− nominal
25− phantom
data/examples/declaration/splice/bracket-declaration-out.hsnew file+26
@@ -0,0 +1,26 @@
1+{-# LANGUAGE TemplateHaskell #-}
2+
3+[d|data T a where Foo :: T ()|]
4+
5+foo =
6+ [d|
7+ foo :: Int -> Char
8+
9+ bar = 42
10+ |]
11+
12+[d|
13+ data T = T
14+ deriving (Eq, Ord, Enum, Bounded, Show)
15+ |]
16+
17+$(do [d|baz = baz|])
18+
19+$(singletons [d|data T = T deriving (Eq, Ord, Enum, Bounded, Show)|])
20+
21+$( singletons
22+ [d|
23+ data T = T
24+ deriving (Eq, Ord, Enum, Bounded, Show)
25+ |]
26+ )
data/examples/declaration/splice/bracket-declaration.hsnew file+22
@@ -0,0 +1,22 @@
1+{-# LANGUAGE TemplateHaskell #-}
2+
3+[d| data T a where Foo :: T () |]
4+
5+foo = [d|
6+ foo:: Int -> Char
7+ bar = 42
8+ |]
9+
10+[d|
11+ data T = T
12+ deriving (Eq, Ord, Enum, Bounded, Show)
13+ |]
14+
15+$( do [d| baz = baz |] )
16+
17+$(singletons [d| data T = T deriving (Eq, Ord, Enum, Bounded, Show) |])
18+
19+$(singletons [d|
20+ data T = T
21+ deriving (Eq, Ord, Enum, Bounded, Show)
22+ |])
data/examples/declaration/splice/bracket-out.hs−7
@@ -12,13 +12,6 @@ foo =
12
12
13foo = [t|Char|]
13foo = [t|Char|]
14
14
15−foo =
16− [d|
17− foo :: Int -> Char
18−
19− bar = 42
20− |]
21−
22foo =
15foo =
23 [||
16 [||
24 foo bar
17 foo bar
data/examples/declaration/splice/bracket.hs−5
@@ -8,10 +8,5 @@ foo = [e| foo bar
8
8
9foo = [t| Char |]
9foo = [t| Char |]
10
10
11−foo = [d|
12− foo:: Int -> Char
13− bar = 42
14− |]
15−
16foo = [|| foo bar
11foo = [|| foo bar
17 ||]
12 ||]
data/examples/declaration/splice/splice-decl-out.hs−18
@@ -15,21 +15,3 @@ foo bar
15-- TemplateHaskell allows Q () at the top level
15-- TemplateHaskell allows Q () at the top level
16do
16do
17 pure []
17 pure []
18−
19−$(do [d|baz = baz|])
20−
21−[d|data T a where Foo :: T ()|]
22−
23−[d|
24− data T = T
25− deriving (Eq, Ord, Enum, Bounded, Show)
26− |]
27−
28−$(singletons [d|data T = T deriving (Eq, Ord, Enum, Bounded, Show)|])
29−
30−$( singletons
31− [d|
32− data T = T
33− deriving (Eq, Ord, Enum, Bounded, Show)
34− |]
35− )
data/examples/declaration/splice/splice-decl.hs−16
@@ -16,19 +16,3 @@ foo bar
16do
16do
17 pure []
17 pure []
18
18
19−$( do [d| baz = baz |] )
20−
21−[d| data T a where Foo :: T () |]
22−
23−[d|
24− data T = T
25− deriving (Eq, Ord, Enum, Bounded, Show)
26− |]
27−
28−$(singletons [d| data T = T deriving (Eq, Ord, Enum, Bounded, Show) |])
29−
30−$(singletons [d|
31− data T = T
32− deriving (Eq, Ord, Enum, Bounded, Show)
33− |])
34−
data/examples/declaration/type-synonyms/multi-line-out.hs+8
@@ -11,3 +11,11 @@ type Foo
11 = Bar
11 = Bar
12 Baz
12 Baz
13 Quux
13 Quux
14+
15+type API
16+ = "route1" :> ApiRoute1
17+ :<|> "route2"
18+ :> ApiRoute2 -- comment here
19+ :<|> OmitDocs
20+ :> "i"
21+ :> ASomething API
data/examples/declaration/type-synonyms/multi-line.hs+8
@@ -10,3 +10,11 @@ type Foo =
10 Bar
10 Bar
11 Baz
11 Baz
12 Quux
12 Quux
13+
14+type API
15+ = "route1" :> ApiRoute1
16+ :<|> "route2" :> ApiRoute2 -- comment here
17+ :<|> OmitDocs :> "i" :> ASomething API
18+
19+
20+
data/examples/declaration/value/function/arrow/proc-do-simple1-out.hsnew file+17
@@ -0,0 +1,17 @@
1+{-# LANGUAGE Arrows #-}
2+
3+bar f = proc a -> do
4+ b <- f -< a
5+
6+barbar f g = proc a -> do
7+ b <- f -< a
8+ returnA -< b
9+
10+barbaz f g = proc (a, b) -> do
11+ c <- f -< a
12+ d <- g -< b
13+
14+bazbar f = proc a -> do
15+ a <-
16+ f -<
17+ a
data/examples/declaration/value/function/arrow/proc-do-simple1.hsnew file+20
@@ -0,0 +1,20 @@
1+{-# LANGUAGE Arrows #-}
2+
3+bar f = proc a ->
4+ do b <- f -< a
5+
6+barbar f g = proc a ->
7+ do b <- f -< a
8+ returnA -< b
9+
10+barbaz f g = proc (a, b) ->
11+ do c <- f -< a
12+ d <- g -< b
13+
14+bazbar f = proc a ->
15+ do a
16+ <-
17+ f
18+ -<
19+ a
20+
data/examples/declaration/value/function/arrow/proc-do-simple-out.hs → data/examples/declaration/value/function/arrow/proc-do-simple2-out.hsrenamed−16
@@ -3,22 +3,6 @@
3foo f = proc a -> do
3foo f = proc a -> do
4 f -< a
4 f -< a
5
5
6−bar f = proc a -> do
7− b <- f -< a
8−
9−barbar f g = proc a -> do
10− b <- f -< a
11− returnA -< b
12−
13−barbaz f g = proc (a, b) -> do
14− c <- f -< a
15− d <- g -< b
16−
17−bazbar f = proc a -> do
18− a <-
19− f -<
20− a
21−
22bazbaz f g h = proc (a, b, c) -> do
6bazbaz f g h = proc (a, b, c) -> do
23 x <-
7 x <-
24 f b -< a
8 f b -< a
data/examples/declaration/value/function/arrow/proc-do-simple.hs → data/examples/declaration/value/function/arrow/proc-do-simple2.hsrenamed−19
@@ -1,26 +1,7 @@
1{-# LANGUAGE Arrows #-}
1{-# LANGUAGE Arrows #-}
2−
3foo f = proc a ->
2foo f = proc a ->
4 do f -< a
3 do f -< a
5
4
6−bar f = proc a ->
7− do b <- f -< a
8−
9−barbar f g = proc a ->
10− do b <- f -< a
11− returnA -< b
12−
13−barbaz f g = proc (a, b) ->
14− do c <- f -< a
15− d <- g -< b
16−
17−bazbar f = proc a ->
18− do a
19− <-
20− f
21− -<
22− a
23−
24bazbaz f g h = proc (a, b, c) ->
5bazbaz f g h = proc (a, b, c) ->
25 do x
6 do x
26 <- f b -< a
7 <- f b -< a
data/examples/declaration/value/function/arrow/proc-forms-out.hsdeleted−35
@@ -1,35 +0,0 @@
1−{-# LANGUAGE Arrows #-}
2−
3−foo0 f g x y = proc _ -> (|f (g -< (x, y))|)
4−
5−foo1 f g h x =
6− proc (y, z) ->
7− (|test (h f . (h g) -< (y x) . y z) ((h g) . h f -< y z . (y x))|)
8−
9−foo2 f g h x =
10− proc (y, z) ->
11− (| test
12− ( h f
13− . h g -<
14− y x
15− . y z
16− )
17− ( h g
18− . h f -<
19− y z
20− . y x
21− )
22− |)
23−
24−bar0 f g x y = proc _ -> f -< x &&& g -< y
25−
26−bar1 f g h x =
27− proc (y, z) ->
28− h f . (h g) -< (y x) . y z ||| (h g) . h f -< y z . (y x)
29−
30−bar2 f g h x =
31− proc (y, z) ->
32− (h f . h g) -<
33− (y x) . y z
34− ||| (h g . h f) -<
35− y z . (y x)
data/examples/declaration/value/function/arrow/proc-forms.hsdeleted−36
@@ -1,36 +0,0 @@
1−{-# LANGUAGE Arrows #-}
2−
3−foo0 f g x y = proc _ -> (| f (g -< (x, y)) |)
4−
5−foo1 f g h x =
6− proc (y, z) ->
7− (| test (h f.(h g) -< (y x).y z)((h g) . h f-<y z . (y x)) |)
8−
9−foo2 f g h x =
10− proc (y, z) -> (|
11− test ( h f
12− . h g
13− -<
14− y x
15− . y z
16− )
17− ( h g
18− . h f
19− -<
20− y z
21− . y x)
22− |)
23−
24−bar0 f g x y = proc _ -> f -< x&&&g -< y
25−
26−bar1 f g h x =
27− proc (y, z) ->
28− h f.(h g) -< (y x).y z ||| (h g) . h f-<y z . (y x)
29−
30−bar2 f g h x =
31− proc (y, z) ->
32− (h f.h g)
33− -< (y x).y z
34− |||
35− (h g . h f)
36− -<y z . (y x)
data/examples/declaration/value/function/arrow/proc-forms1-out.hsnew file+18
@@ -0,0 +1,18 @@
1+{-# LANGUAGE Arrows #-}
2+
3+foo0 f g x y = proc _ -> (|f (g -< (x, y))|)
4+
5+foo1 f g h x =
6+ proc (y, z) ->
7+ (| test
8+ ( h f
9+ . h g -<
10+ y x
11+ . y z
12+ )
13+ ( h g
14+ . h f -<
15+ y z
16+ . y x
17+ )
18+ |)
data/examples/declaration/value/function/arrow/proc-forms1.hsnew file+19
@@ -0,0 +1,19 @@
1+{-# LANGUAGE Arrows #-}
2+
3+foo0 f g x y = proc _ -> (| f (g -< (x, y)) |)
4+
5+foo1 f g h x =
6+ proc (y, z) -> (|
7+ test ( h f
8+ . h g
9+ -<
10+ y x
11+ . y z
12+ )
13+ ( h g
14+ . h f
15+ -<
16+ y z
17+ . y x)
18+ |)
19+
data/examples/declaration/value/function/arrow/proc-forms2-out.hsnew file+18
@@ -0,0 +1,18 @@
1+{-# LANGUAGE Arrows #-}
2+
3+bar0 f g h x =
4+ proc (y, z) ->
5+ (|test (h f . (h g) -< (y x) . y z) ((h g) . h f -< y z . (y x))|)
6+
7+bar1 f g x y = proc _ -> f -< x &&& g -< y
8+
9+bar2 f g h x =
10+ proc (y, z) ->
11+ h f . (h g) -< (y x) . y z ||| (h g) . h f -< y z . (y x)
12+
13+bar3 f g h x =
14+ proc (y, z) ->
15+ (h f . h g) -<
16+ (y x) . y z
17+ ||| (h g . h f) -<
18+ y z . (y x)
data/examples/declaration/value/function/arrow/proc-forms2.hsnew file+19
@@ -0,0 +1,19 @@
1+{-# LANGUAGE Arrows #-}
2+
3+bar0 f g h x =
4+ proc (y, z) ->
5+ (| test (h f.(h g) -< (y x).y z)((h g) . h f-<y z . (y x)) |)
6+
7+bar1 f g x y = proc _ -> f -< x&&&g -< y
8+
9+bar2 f g h x =
10+ proc (y, z) ->
11+ h f.(h g) -< (y x).y z ||| (h g) . h f-<y z . (y x)
12+
13+bar3 f g h x =
14+ proc (y, z) ->
15+ (h f.h g)
16+ -< (y x).y z
17+ |||
18+ (h g . h f)
19+ -<y z . (y x)
data/examples/declaration/value/function/case-multi-line-guards-out.hsnew file+9
@@ -0,0 +1,9 @@
1+withGuards :: Int -> Int
2+withGuards x =
3+ case x of
4+ x
5+ | x > 10 ->
6+ foo
7+ + bar
8+ x | x > 5 -> 10
9+ _ -> 20
data/examples/declaration/value/function/case-multi-line-guards.hsnew file+9
@@ -0,0 +1,9 @@
1+withGuards :: Int -> Int
2+withGuards x =
3+ case x of
4+ x | x > 10 ->
5+ foo +
6+ bar
7+ x | x > 5 -> 10
8+ _ -> 20
9+
data/examples/declaration/value/function/case-multi-line-out.hs−10
@@ -21,16 +21,6 @@ quux :: Int -> Int
21quux x = case x of
21quux x = case x of
22 x -> x
22 x -> x
23
23
24−withGuards :: Int -> Int
25−withGuards x =
26− case x of
27− x
28− | x > 10 ->
29− foo
30− + bar
31− x | x > 5 -> 10
32− _ -> 20
33−
34funnyComment =
24funnyComment =
35 -- comment
25 -- comment
36 case () of
26 case () of
data/examples/declaration/value/function/case-multi-line.hs−9
@@ -18,15 +18,6 @@ quux :: Int -> Int
18quux x = case x of
18quux x = case x of
19 x -> x
19 x -> x
20
20
21−withGuards :: Int -> Int
22−withGuards x =
23− case x of
24− x | x > 10 ->
25− foo +
26− bar
27− x | x > 5 -> 10
28− _ -> 20
29−
30funnyComment = -- comment
21funnyComment = -- comment
31 case () of
22 case () of
32 () -> ()
23 () -> ()
data/examples/declaration/value/function/comprehension/transform-multi-line1-out.hsnew file+11
@@ -0,0 +1,11 @@
1+{-# LANGUAGE TransformListComp #-}
2+
3+foo' xs ys =
4+ [ ( x,
5+ y
6+ )
7+ | x <- xs,
8+ y <- ys,
9+ -- First comment
10+ then reverse -- Second comment
11+ ]
data/examples/declaration/value/function/comprehension/transform-multi-line1.hsnew file+10
@@ -0,0 +1,10 @@
1+{-# LANGUAGE TransformListComp #-}
2+
3+foo' xs ys = [
4+ (x,
5+ y) |
6+ x <- xs,
7+ y <- ys,
8+ then -- First comment
9+ reverse -- Second comment
10+ ]
data/examples/declaration/value/function/comprehension/transform-multi-line2-out.hsnew file+15
@@ -0,0 +1,15 @@
1+{-# LANGUAGE TransformListComp #-}
2+
3+bar' xs ys =
4+ [ ( x,
5+ y
6+ )
7+ | x <- xs,
8+ y <- ys,
9+ -- First comment
10+ then sortWith
11+ by
12+ ( x
13+ + y -- Second comment
14+ )
15+ ]
data/examples/declaration/value/function/comprehension/transform-multi-line2.hsnew file+15
@@ -0,0 +1,15 @@
1+{-# LANGUAGE TransformListComp #-}
2+
3+bar' xs ys = [
4+ (x,
5+ y) |
6+ x <- xs,
7+ y <- ys,
8+ then -- First comment
9+ sortWith
10+ by
11+ (x
12+ + y) -- Second comment
13+ ]
14+
15+
data/examples/declaration/value/function/comprehension/transform-multi-line3-out.hsnew file+11
@@ -0,0 +1,11 @@
1+{-# LANGUAGE TransformListComp #-}
2+
3+baz' xs ys =
4+ [ ( x,
5+ y
6+ )
7+ | x <- xs,
8+ y <- ys,
9+ -- First comment
10+ then group using permutations -- Second comment
11+ ]
data/examples/declaration/value/function/comprehension/transform-multi-line3.hsnew file+13
@@ -0,0 +1,13 @@
1+{-# LANGUAGE TransformListComp #-}
2+
3+baz' xs ys = [
4+ (x,
5+ y) |
6+ x <- xs,
7+ y <- ys,
8+ then
9+ group
10+ using -- First comment
11+ permutations -- Second comment
12+ ]
13+
data/examples/declaration/value/function/comprehension/transform-multi-line4-out.hsnew file+16
@@ -0,0 +1,16 @@
1+{-# LANGUAGE TransformListComp #-}
2+
3+quux' xs ys =
4+ [ ( x,
5+ y
6+ )
7+ | x <- xs,
8+ y <- ys,
9+ -- First comment
10+ then group by
11+ ( x
12+ + y
13+ )
14+ -- Second comment
15+ using groupWith -- Third comment
16+ ]
data/examples/declaration/value/function/comprehension/transform-multi-line4.hsnew file+15
@@ -0,0 +1,15 @@
1+{-# LANGUAGE TransformListComp #-}
2+
3+quux' xs ys = [
4+ (x,
5+ y) |
6+ x <- xs,
7+ y <- ys,
8+ then
9+ group
10+ by -- First comment
11+ (x
12+ + y)
13+ using -- Second comment
14+ groupWith -- Third comment
15+ ]
data/examples/declaration/value/function/comprehension/transform-single-line-out.hsnew file+9
@@ -0,0 +1,9 @@
1+{-# LANGUAGE TransformListComp #-}
2+
3+foo xs ys = [(x, y) | x <- xs, y <- ys, then reverse]
4+
5+bar xs ys = [(x, y) | x <- xs, y <- ys, then sortWith by (x + y)]
6+
7+baz xs ys = [(x, y) | x <- xs, y <- ys, then group using permutations]
8+
9+quux xs ys = [(x, y) | x <- xs, y <- ys, then group by (x + y) using groupWith]
data/examples/declaration/value/function/comprehension/transform-single-line.hsnew file+9
@@ -0,0 +1,9 @@
1+{-# LANGUAGE TransformListComp #-}
2+
3+foo xs ys = [(x, y) | x <- xs, y <- ys, then reverse]
4+
5+bar xs ys = [(x, y) | x <- xs, y <- ys, then sortWith by (x + y)]
6+
7+baz xs ys = [(x, y) | x <- xs, y <- ys, then group using permutations]
8+
9+quux xs ys = [(x, y) | x <- xs, y <- ys, then group by (x + y) using groupWith]
data/examples/declaration/value/function/do-out.hsdeleted−111
@@ -1,111 +0,0 @@
1−{-# LANGUAGE RecursiveDo #-}
2−
3−bar = do foo; bar
4−
5−baz =
6− mdo
7− bar a
8− a <- foo
9− b <-
10− bar
11− 1
12− 2
13− 3
14− return (a + b)
15−
16−baz = do
17− a <- foo
18− let b = a + 2
19− c = b + 3
20− bar c
21− let d = c + 2
22− return d
23−
24−quux = something $ do
25− foo
26− case x of
27− 1 -> 10
28− 2 -> 20
29− bar
30− if something
31− then x
32− else y
33− baz
34−
35−foo = do
36− rec a <- b + 5
37− let d = c
38− b <- a * 5
39− something
40− c <- a + b
41− print c
42− rec something $ do
43− x <- a
44− print x
45− y <- c
46− print y
47−
48−trickyLet = do
49− foo
50− let x = 5
51− in bar x
52−
53−f = unFoo . foo bar baz 3 $ do
54− act
55− ret
56−
57−g = unFoo
58− . foo
59− bar
60− baz
61− 3
62− $ do
63− act
64− ret
65−
66−main =
67− do stuff
68− `finally` do
69− recover
70−
71−main = do stuff `finally` recover
72−
73−main = do { stuff } `finally` recover
74−
75−foo = do do { foo; bar }; baz
76−
77−foo =
78− do
79− 1
80− + 2
81−
82−-- single line let-where
83−samples n f = do
84− gen <- newQCGen
85− let rands g = g1 : rands g2 where { (g1, g2) = split g }
86− return $ rands gen
87−
88−main = do bar
89−
90−main = do bar; baz
91−
92−main = do
93− bar
94− baz
95−
96−main = do
97− a <- bar
98− let a = b; c = d
99− baz d
100− let e = f
101− g = h
102− return c
103−
104−readInClause = do
105− do
106− lookAhead g_Do
107− parseNote ErrorC 1063 "You need a line feed or semicolon before the 'do'."
108− <|> do
109− optional g_Semi
110− void allspacing
111− return things
data/examples/declaration/value/function/do.hsdeleted−111
@@ -1,111 +0,0 @@
1−{-# LANGUAGE RecursiveDo #-}
2−
3−bar = do { foo; bar }
4−
5−baz =
6− mdo bar a
7− a <- foo
8− b <- bar
9− 1 2 3
10− return (a + b)
11−
12−baz = do
13− a <- foo
14− let b = a + 2
15− c = b + 3
16− bar c
17− let d = c + 2
18− return d
19−
20−quux = something $ do
21− foo
22− case x of
23− 1 -> 10
24− 2 -> 20
25− bar
26− if something
27− then x
28− else y
29− baz
30−
31−foo = do
32− rec
33− a <- b + 5
34−
35− let d = c
36−
37− b <- a * 5
38−
39− something
40−
41− c <- a + b
42− print c
43− rec something $ do
44− x <- a
45− print x
46−
47− y <- c
48− print y
49−
50−trickyLet = do
51− foo
52− let x = 5
53− in bar x
54−
55−f = unFoo . foo bar baz 3 $ do
56− act
57− ret
58−
59−g = unFoo . foo
60− bar
61− baz 3 $ do
62− act
63− ret
64−
65−main =
66− do stuff
67− `finally` do
68− recover
69−
70−main = do stuff `finally` recover
71−
72−main = do { stuff } `finally` recover
73−
74−foo = do { do {foo; bar}; baz }
75−
76−foo = do
77− 1
78− +
79− 2
80−
81−-- single line let-where
82−samples n f = do
83− gen <- newQCGen
84− let rands g = g1 : rands g2 where (g1, g2) = split g
85− return $ rands gen
86−
87−main = do bar
88−main = do { bar; baz }
89−main = do { bar
90− ; baz
91− }
92−
93−main = do
94− a <- bar
95− let a = b; c = d
96− baz d
97− let e = f
98− g = h
99− return c
100−
101−readInClause = do
102− do {
103− lookAhead g_Do;
104− parseNote ErrorC 1063 "You need a line feed or semicolon before the 'do'.";
105− } <|> do {
106− optional g_Semi;
107− void allspacing;
108− }
109−
110− return things
111−
data/examples/declaration/value/function/do/blocks-out.hsnew file+18
@@ -0,0 +1,18 @@
1+foo = do bar
2+
3+foo = do bar; baz
4+
5+foo = do
6+ bar
7+ baz
8+
9+foo = do do { foo; bar }; baz
10+
11+readInClause = do
12+ do
13+ lookAhead g_Do
14+ parseNote ErrorC 1063 "You need a line feed or semicolon before the 'do'."
15+ <|> do
16+ optional g_Semi
17+ void allspacing
18+ return things
data/examples/declaration/value/function/do/blocks.hsnew file+17
@@ -0,0 +1,17 @@
1+foo = do bar
2+foo = do { bar; baz }
3+foo = do { bar
4+ ; baz
5+ }
6+foo = do { do {foo; bar}; baz }
7+
8+readInClause = do
9+ do {
10+ lookAhead g_Do;
11+ parseNote ErrorC 1063 "You need a line feed or semicolon before the 'do'.";
12+ } <|> do {
13+ optional g_Semi;
14+ void allspacing;
15+ }
16+
17+ return things
data/examples/declaration/value/function/do/expr-out.hsnew file+10
@@ -0,0 +1,10 @@
1+quux = something $ do
2+ foo
3+ case x of
4+ 1 -> 10
5+ 2 -> 20
6+ bar
7+ if something
8+ then x
9+ else y
10+ baz
data/examples/declaration/value/function/do/expr.hsnew file+11
@@ -0,0 +1,11 @@
1+quux = something $ do
2+ foo
3+ case x of
4+ 1 -> 10
5+ 2 -> 20
6+ bar
7+ if something
8+ then x
9+ else y
10+ baz
11+
data/examples/declaration/value/function/do/hanging-out.hsnew file

No changes to the content.

data/examples/declaration/value/function/do/hanging.hsnew file

No changes to the content.

data/examples/declaration/value/function/do/let-out.hsnew file+18
@@ -0,0 +1,18 @@
1+main = do
2+ a <- bar
3+ let a = b; c = d
4+ baz d
5+ let e = f
6+ g = h
7+ return c
8+
9+-- single line let-where
10+samples n f = do
11+ gen <- newQCGen
12+ let rands g = g1 : rands g2 where { (g1, g2) = split g }
13+ return $ rands gen
14+
15+trickyLet = do
16+ foo
17+ let x = 5
18+ in bar x
data/examples/declaration/value/function/do/let.hsnew file+18
@@ -0,0 +1,18 @@
1+main = do
2+ a <- bar
3+ let a = b; c = d
4+ baz d
5+ let e = f
6+ g = h
7+ return c
8+
9+-- single line let-where
10+samples n f = do
11+ gen <- newQCGen
12+ let rands g = g1 : rands g2 where (g1, g2) = split g
13+ return $ rands gen
14+
15+trickyLet = do
16+ foo
17+ let x = 5
18+ in bar x
data/examples/declaration/value/function/do/recursive-do-mdo-out.hsnew file+12
@@ -0,0 +1,12 @@
1+{-# LANGUAGE RecursiveDo #-}
2+
3+baz =
4+ mdo
5+ bar a
6+ a <- foo
7+ b <-
8+ bar
9+ 1
10+ 2
11+ 3
12+ return (a + b)
data/examples/declaration/value/function/do/recursive-do-mdo.hsnew file+8
@@ -0,0 +1,8 @@
1+{-# LANGUAGE RecursiveDo #-}
2+
3+baz =
4+ mdo bar a
5+ a <- foo
6+ b <- bar
7+ 1 2 3
8+ return (a + b)
data/examples/declaration/value/function/do/recursive-do-rec-out.hsnew file+14
@@ -0,0 +1,14 @@
1+{-# LANGUAGE RecursiveDo #-}
2+
3+foo = do
4+ rec a <- b + 5
5+ let d = c
6+ b <- a * 5
7+ something
8+ c <- a + b
9+ print c
10+ rec something $ do
11+ x <- a
12+ print x
13+ y <- c
14+ print y
data/examples/declaration/value/function/do/recursive-do-rec.hsnew file+20
@@ -0,0 +1,20 @@
1+{-# LANGUAGE RecursiveDo #-}
2+
3+foo = do
4+ rec
5+ a <- b + 5
6+
7+ let d = c
8+
9+ b <- a * 5
10+
11+ something
12+
13+ c <- a + b
14+ print c
15+ rec something $ do
16+ x <- a
17+ print x
18+
19+ y <- c
20+ print y
data/examples/declaration/value/function/guards-out.hs−15
@@ -1,18 +1,3 @@
1−foo :: Int -> Int
2−foo x
3− | x == 5 = 10
4− | otherwise = 12
5−
6−bar :: Int -> Int
7−bar x
8− | x == 5 =
9− foo x
10− + foo 10
11− | x == 6 =
12− foo x
13− + foo 20
14− | otherwise = foo 100
15−
16baz :: Int -> Int
1baz :: Int -> Int
17baz x | x < 0 = x
2baz x | x < 0 = x
18baz x | otherwise = x
3baz x | otherwise = x
data/examples/declaration/value/function/guards.hs−13
@@ -1,16 +1,3 @@
1−foo :: Int -> Int
2−foo x
3− | x == 5 = 10
4− | otherwise = 12
5−
6−bar :: Int -> Int
7−bar x
8− | x == 5 = foo x
9− + foo 10
10− | x == 6 = foo x
11− + foo 20
12− | otherwise = foo 100
13−
14baz :: Int -> Int
1baz :: Int -> Int
15baz x | x < 0 = x
2baz x | x < 0 = x
16baz x | otherwise = x
3baz x | otherwise = x
data/examples/declaration/value/function/infix/applicative-out.hsnew file+4
@@ -0,0 +1,4 @@
1+f =
2+ Foo <$> bar
3+ <*> baz
4+ <*> baz'
data/examples/declaration/value/function/infix/applicative.hsnew file+6
@@ -0,0 +1,6 @@
1+
2+f =
3+ Foo <$> bar
4+ <*> baz
5+ <*> baz'
6+
data/examples/declaration/value/function/infix/comments-out.hsnew file+9
@@ -0,0 +1,9 @@
1+main =
2+ bar
3+ $ baz -- bar
4+ -- baz
5+
6+bar
7+ $ {- foo
8+ -}
9+ bar
data/examples/declaration/value/function/infix/comments.hsnew file+11
@@ -0,0 +1,11 @@
1+main =
2+ bar $ -- bar
3+ baz -- baz
4+
5+bar $
6+ {- foo
7+ -}
8+ bar
9+
10+
11+
data/examples/declaration/value/function/infix/do-out.hsnew file+13
@@ -0,0 +1,13 @@
1+main =
2+ do stuff
3+ `finally` do
4+ recover
5+
6+main = do stuff `finally` recover
7+
8+main = do { stuff } `finally` recover
9+
10+foo =
11+ do
12+ 1
13+ + 2
data/examples/declaration/value/function/infix/do.hsnew file+13
@@ -0,0 +1,13 @@
1+main =
2+ do stuff
3+ `finally` do
4+ recover
5+
6+main = do stuff `finally` recover
7+
8+main = do { stuff } `finally` recover
9+
10+foo = do
11+ 1
12+ +
13+ 2
data/examples/declaration/value/function/infix/hanging-out.hsnew file+22
@@ -0,0 +1,22 @@
1+f = unFoo . foo bar baz 3 $ do
2+ act
3+ ret
4+
5+g = unFoo
6+ . foo
7+ bar
8+ baz
9+ 3
10+ $ do
11+ act
12+ ret
13+
14+update =
15+ do
16+ foobar
17+ `catch` \case
18+ a -> a
19+
20+foo = bar
21+ ++ case foo of
22+ a -> a
data/examples/declaration/value/function/infix/hanging.hsnew file+19
@@ -0,0 +1,19 @@
1+f = unFoo . foo bar baz 3 $ do
2+ act
3+ ret
4+
5+g = unFoo . foo
6+ bar
7+ baz 3 $ do
8+ act
9+ ret
10+
11+update =
12+ do
13+ foobar
14+ `catch` \case
15+ a -> a
16+
17+foo = bar ++
18+ case foo of
19+ a -> a
data/examples/declaration/value/function/infix/lenses-out.hsnew file+11
@@ -0,0 +1,11 @@
1+lenses =
2+ Just $ M.fromList
3+ $ "type"
4+ .= ("user.connection" :: Text)
5+ # "connection"
6+ .= uc
7+ # "user"
8+ .= case name of
9+ Just n -> Just $ object ["name" .= n]
10+ Nothing -> Nothing
11+ # []
data/examples/declaration/value/function/infix/lenses.hsnew file+7
@@ -0,0 +1,7 @@
1+lenses = Just $ M.fromList
2+ $ "type" .= ("user.connection" :: Text)
3+ # "connection" .= uc
4+ # "user" .= case name of
5+ Just n -> Just $ object ["name" .= n]
6+ Nothing -> Nothing
7+ # []
data/examples/declaration/value/function/infix-out.hs → data/examples/declaration/value/function/infix/simple-out.hsrenamed

The content is the same.

data/examples/declaration/value/function/infix.hs → data/examples/declaration/value/function/infix/simple.hsrenamed

The content is the same.

data/examples/declaration/value/function/lambda-multi-line1-out.hsnew file+14
@@ -0,0 +1,14 @@
1+foo :: a -> a -> a
2+foo x = \y ->
3+ x
4+
5+bar :: Int -> Int -> Int
6+bar x = \y ->
7+ if x > y
8+ then 10
9+ else 12
10+
11+foo =
12+ prop "is inverse to closure" $ \(f :: StaticPtr (Int -> Int))
13+ (x :: Int) ->
14+ (unclosure . closure) f x == deRefStaticPtr f x
data/examples/declaration/value/function/lambda-multi-line1.hsnew file+15
@@ -0,0 +1,15 @@
1+foo :: a -> a -> a
2+foo x = \y ->
3+ x
4+
5+bar :: Int -> Int -> Int
6+bar x = \y ->
7+ if x > y
8+ then 10
9+ else 12
10+
11+foo =
12+ prop "is inverse to closure" $ \(f :: StaticPtr (Int -> Int))
13+ (x :: Int) ->
14+ (unclosure . closure) f x == deRefStaticPtr f x
15+
data/examples/declaration/value/function/lambda-multi-line-out.hs → data/examples/declaration/value/function/lambda-multi-line2-out.hsrenamed−15
@@ -1,13 +1,3 @@
1−foo :: a -> a -> a
2−foo x = \y ->
3− x
4−
5−bar :: Int -> Int -> Int
6−bar x = \y ->
7− if x > y
8− then 10
9− else 12
10−
11tricky0 =
1tricky0 =
12 flip all (zip ws gs) $ \(wt, gt) ->
2 flip all (zip ws gs) $ \(wt, gt) ->
13 canUnify poly_given_ok wt gt || go False wt gt
3 canUnify poly_given_ok wt gt || go False wt gt
@@ -20,8 +10,3 @@ tricky2 =
20 flip all (zip ws gs)
10 flip all (zip ws gs)
21 $ \(wt, gt) ->
11 $ \(wt, gt) ->
22 canUnify poly_given_ok wt gt || go False wt gt
12 canUnify poly_given_ok wt gt || go False wt gt
23−
24−foo =
25− prop "is inverse to closure" $ \(f :: StaticPtr (Int -> Int))
26− (x :: Int) ->
27− (unclosure . closure) f x == deRefStaticPtr f x
data/examples/declaration/value/function/lambda-multi-line.hs → data/examples/declaration/value/function/lambda-multi-line2.hsrenamed−15
@@ -1,13 +1,3 @@
1−foo :: a -> a -> a
2−foo x = \y ->
3− x
4−
5−bar :: Int -> Int -> Int
6−bar x = \y ->
7− if x > y
8− then 10
9− else 12
10−
11tricky0 =
1tricky0 =
12 flip all (zip ws gs) $ \(wt, gt) ->
2 flip all (zip ws gs) $ \(wt, gt) ->
13 canUnify poly_given_ok wt gt || go False wt gt
3 canUnify poly_given_ok wt gt || go False wt gt
@@ -21,8 +11,3 @@ tricky2 =
21 \(wt, gt) ->
11 \(wt, gt) ->
22 canUnify poly_given_ok wt gt || go False wt gt
12 canUnify poly_given_ok wt gt || go False wt gt
23
13
24−foo =
25− prop "is inverse to closure" $ \(f :: StaticPtr (Int -> Int))
26− (x :: Int) ->
27− (unclosure . closure) f x == deRefStaticPtr f x
28−
data/examples/declaration/value/function/multiple-guards-out.hsnew file+14
@@ -0,0 +1,14 @@
1+foo :: Int -> Int
2+foo x
3+ | x == 5 = 10
4+ | otherwise = 12
5+
6+bar :: Int -> Int
7+bar x
8+ | x == 5 =
9+ foo x
10+ + foo 10
11+ | x == 6 =
12+ foo x
13+ + foo 20
14+ | otherwise = foo 100
data/examples/declaration/value/function/multiple-guards.hsnew file+13
@@ -0,0 +1,13 @@
1+foo :: Int -> Int
2+foo x
3+ | x == 5 = 10
4+ | otherwise = 12
5+
6+bar :: Int -> Int
7+bar x
8+ | x == 5 = foo x
9+ + foo 10
10+ | x == 6 = foo x
11+ + foo 20
12+ | otherwise = foo 100
13+
data/examples/declaration/value/function/operators-out.hsdeleted−45
@@ -1,45 +0,0 @@
1−foo = bar
2− ++ case foo of
3− a -> a
4−
5−main =
6− bar
7− $ baz -- bar
8− -- baz
9−
10−bar
11− $ {- foo
12− -}
13− bar
14−
15−f =
16− Foo <$> bar
17− <*> baz
18−
19−update =
20− do
21− foobar
22− `catch` \case
23− a -> a
24−
25−foo =
26− do
27− 1
28− + 2
29−
30−main =
31− do stuff
32− `finally` do
33− recover
34−
35−lenses =
36− Just $ M.fromList
37− $ "type"
38− .= ("user.connection" :: Text)
39− # "connection"
40− .= uc
41− # "user"
42− .= case name of
43− Just n -> Just $ object ["name" .= n]
44− Nothing -> Nothing
45− # []
data/examples/declaration/value/function/operators.hsdeleted−40
@@ -1,40 +0,0 @@
1−foo = bar ++
2− case foo of
3− a -> a
4−
5−main =
6− bar $ -- bar
7− baz -- baz
8−
9−bar $
10− {- foo
11− -}
12− bar
13−
14−f =
15− Foo <$> bar
16− <*> baz
17−
18−update =
19− do
20− foobar
21− `catch` \case
22− a -> a
23−
24−foo = do
25− 1
26− +
27− 2
28−
29−main =
30− do stuff
31− `finally` do
32− recover
33−
34−lenses = Just $ M.fromList
35− $ "type" .= ("user.connection" :: Text)
36− # "connection" .= uc
37− # "user" .= case name of
38− Just n -> Just $ object ["name" .= n]
39− Nothing -> Nothing
40− # []
data/examples/declaration/value/function/parallel-comprehensions-out.hs → data/examples/declaration/value/function/parallel-comprehensions-complex-out.hsrenamed−4
@@ -1,7 +1,3 @@
1−foo x y = [(a, b) | a <- x | b <- y]
2−
3−bar x y z w = [(a, b, c, d) | a <- x, b <- y, a `mod` b == 0 | c <- z | d <- w]
4−
5baz x y z w =
1baz x y z w =
6 [ ( a,
2 [ ( a,
7 b,
3 b,
data/examples/declaration/value/function/parallel-comprehensions.hs → data/examples/declaration/value/function/parallel-comprehensions-complex.hsrenamed−4
@@ -1,7 +1,3 @@
1−foo x y = [(a,b) | a<-x | b<-y]
2−
3−bar x y z w = [(a,b,c,d) | a<-x, b<-y, a`mod`b == 0|c<-z|d<-w ]
4−
5baz x y z w = [
1baz x y z w = [
6 (a,b,c,d,e,
2 (a,b,c,d,e,
7 f,g,h,i,j) |
3 f,g,h,i,j) |
data/examples/declaration/value/function/parallel-comprehensions-single-line-out.hsnew file+3
@@ -0,0 +1,3 @@
1+foo x y = [(a, b) | a <- x | b <- y]
2+
3+bar x y z w = [(a, b, c, d) | a <- x, b <- y, a `mod` b == 0 | c <- z | d <- w]
data/examples/declaration/value/function/parallel-comprehensions-single-line.hsnew file+4
@@ -0,0 +1,4 @@
1+foo x y = [(a,b) | a<-x | b<-y]
2+
3+bar x y z w = [(a,b,c,d) | a<-x, b<-y, a`mod`b == 0|c<-z|d<-w ]
4+
data/examples/declaration/value/function/transform-comprehensions-out.hsdeleted−58
@@ -1,58 +0,0 @@
1−{-# LANGUAGE TransformListComp #-}
2−
3−foo xs ys = [(x, y) | x <- xs, y <- ys, then reverse]
4−
5−foo' xs ys =
6− [ ( x,
7− y
8− )
9− | x <- xs,
10− y <- ys,
11− -- First comment
12− then reverse -- Second comment
13− ]
14−
15−bar xs ys = [(x, y) | x <- xs, y <- ys, then sortWith by (x + y)]
16−
17−bar' xs ys =
18− [ ( x,
19− y
20− )
21− | x <- xs,
22− y <- ys,
23− -- First comment
24− then sortWith
25− by
26− ( x
27− + y -- Second comment
28− )
29− ]
30−
31−baz xs ys = [(x, y) | x <- xs, y <- ys, then group using permutations]
32−
33−baz' xs ys =
34− [ ( x,
35− y
36− )
37− | x <- xs,
38− y <- ys,
39− -- First comment
40− then group using permutations -- Second comment
41− ]
42−
43−quux xs ys = [(x, y) | x <- xs, y <- ys, then group by (x + y) using groupWith]
44−
45−quux' xs ys =
46− [ ( x,
47− y
48− )
49− | x <- xs,
50− y <- ys,
51− -- First comment
52− then group by
53− ( x
54− + y
55− )
56− -- Second comment
57− using groupWith -- Third comment
58− ]
data/examples/declaration/value/function/transform-comprehensions.hsdeleted−55
@@ -1,55 +0,0 @@
1−{-# LANGUAGE TransformListComp #-}
2−
3−foo xs ys = [(x, y) | x <- xs, y <- ys, then reverse]
4−
5−foo' xs ys = [
6− (x,
7− y) |
8− x <- xs,
9− y <- ys,
10− then -- First comment
11− reverse -- Second comment
12− ]
13−
14−bar xs ys = [(x, y) | x <- xs, y <- ys, then sortWith by (x + y)]
15−
16−bar' 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− ]
27−
28−baz xs ys = [(x, y) | x <- xs, y <- ys, then group using permutations]
29−
30−baz' 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− ]
40−
41−quux xs ys = [(x, y) | x <- xs, y <- ys, then group by (x + y) using groupWith]
42−
43−quux' 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− ]