diff options
author | Péter Diviánszky <divipp@gmail.com> | 2016-05-05 17:55:01 +0200 |
---|---|---|
committer | Péter Diviánszky <divipp@gmail.com> | 2016-05-05 17:55:01 +0200 |
commit | 9e232c77ee6d0948f7dd5727d3ec568bbedf4316 (patch) | |
tree | d9f64543cf48a964fd29e95b87b824f9b5c2a877 /testdata/Prelude.out | |
parent | f24ab8bd8d5cb60a7a75e52655b567f916f73a53 (diff) |
improve pretty printing & try to fix local function handling
Diffstat (limited to 'testdata/Prelude.out')
-rw-r--r-- | testdata/Prelude.out | 137 |
1 files changed, 71 insertions, 66 deletions
diff --git a/testdata/Prelude.out b/testdata/Prelude.out index c42c81d0..90f52a55 100644 --- a/testdata/Prelude.out +++ b/testdata/Prelude.out | |||
@@ -36,13 +36,13 @@ uncurry | |||
36 | _ | 36 | _ |
37 | (\(d :: _) (e :: _) -> hlistConsCase | 37 | (\(d :: _) (e :: _) -> hlistConsCase |
38 | _ | 38 | _ |
39 | (\(f :: _) (g :: _) -> hlistNilCase _ (_rhs (HCons (a d) (HCons (b f) HNil))) g) | 39 | (\(f :: _) (g :: _) -> hlistNilCase _ (_rhs (a d, b f)) g) |
40 | e) | 40 | e) |
41 | c | 41 | c |
42 | 42 | ||
43 | pi = _rhs 3.141592653589793 | 43 | pi = _rhs 3.141592653589793 |
44 | 44 | ||
45 | zip :: forall (a :: _) (b :: _) . [a] -> [b] -> [HList (a : b : '[])] | 45 | zip :: forall (a :: _) (b :: _) . [a] -> [b] -> [(a, b)] |
46 | zip | 46 | zip |
47 | = \(a :: _) (b :: _) -> case'List | 47 | = \(a :: _) (b :: _) -> case'List |
48 | (\_ -> _) | 48 | (\_ -> _) |
@@ -50,16 +50,15 @@ zip | |||
50 | (\(c :: _) (d :: _) -> case'List | 50 | (\(c :: _) (d :: _) -> case'List |
51 | (\_ -> _) | 51 | (\_ -> _) |
52 | (_rhs []) | 52 | (_rhs []) |
53 | (\(e :: _) (f :: _) -> _rhs (HCons c (HCons e HNil) : zip d f)) | 53 | (\(e :: _) (f :: _) -> _rhs ((c, e) : zip d f)) |
54 | b) | 54 | b) |
55 | a | 55 | a |
56 | 56 | ||
57 | unzip | 57 | unzip :: forall (a :: _) (b :: _) . [(a, b)] -> ([a], [b]) |
58 | :: forall (a :: _) (b :: _) . [HList (a : b : '[])] -> HList ([a] : [b] : '[]) | ||
59 | unzip | 58 | unzip |
60 | = \(a :: _) -> case'List | 59 | = \(a :: _) -> case'List |
61 | (\_ -> _) | 60 | (\_ -> _) |
62 | (_rhs (HCons [] (HCons [] HNil))) | 61 | (_rhs ([], [])) |
63 | (\(b :: _) (c :: _) -> hlistConsCase | 62 | (\(b :: _) (c :: _) -> hlistConsCase |
64 | _ | 63 | _ |
65 | (\(d :: _) (e :: _) -> hlistConsCase | 64 | (\(d :: _) (e :: _) -> hlistConsCase |
@@ -67,19 +66,23 @@ unzip | |||
67 | (\(f :: _) (g :: _) -> hlistNilCase | 66 | (\(f :: _) (g :: _) -> hlistNilCase |
68 | _ | 67 | _ |
69 | (_rhs | 68 | (_rhs |
70 | let h = _rhs (unzip c) in let i | 69 | let |
71 | = _rhs | 70 | h = _rhs (unzip c); |
72 | ((\(j :: _) -> hlistConsCase | 71 | i |
73 | _ | 72 | = _rhs |
74 | (\_ (k :: _) -> hlistConsCase _ (\(l :: _) (m :: _) -> hlistNilCase _ l m) k) | 73 | ((\(k :: _) -> hlistConsCase |
75 | j) | 74 | _ |
76 | h) in let n | 75 | (\_ (l :: _) -> hlistConsCase _ (\(m :: _) (n :: _) -> hlistNilCase _ m n) l) |
77 | = _rhs | 76 | k) |
78 | ((\(o :: _) -> hlistConsCase | 77 | h); |
79 | _ | 78 | j |
80 | (\(p :: _) (q :: _) -> hlistConsCase _ (\_ (r :: _) -> hlistNilCase _ p r) q) | 79 | = _rhs |
81 | o) | 80 | ((\(o :: _) -> hlistConsCase |
82 | h) in HCons (d : n) (HCons (f : i) HNil)) | 81 | _ |
82 | (\(p :: _) (q :: _) -> hlistConsCase _ (\_ (r :: _) -> hlistNilCase _ p r) q) | ||
83 | o) | ||
84 | h) | ||
85 | in (d : j, f : i)) | ||
83 | g) | 86 | g) |
84 | e) | 87 | e) |
85 | b) | 88 | b) |
@@ -97,7 +100,7 @@ tail :: forall (a :: _) . [a] -> [a] | |||
97 | tail | 100 | tail |
98 | = \(a :: _) -> case'List (\_ -> _) (_rhs undefined) (\_ (b :: _) -> _rhs b) a | 101 | = \(a :: _) -> case'List (\_ -> _) (_rhs undefined) (\_ (b :: _) -> _rhs b) a |
99 | 102 | ||
100 | pairs :: forall (a :: _) . [a] -> [HList (a : a : '[])] | 103 | pairs :: forall (a :: _) . [a] -> [(a, a)] |
101 | pairs = \(a :: _) -> _rhs (zip a (tail a)) | 104 | pairs = \(a :: _) -> _rhs (zip a (tail a)) |
102 | 105 | ||
103 | foldl' | 106 | foldl' |
@@ -117,21 +120,25 @@ foldr1 | |||
117 | split | 120 | split |
118 | = \(a :: _) -> case'List | 121 | = \(a :: _) -> case'List |
119 | (\_ -> _) | 122 | (\_ -> _) |
120 | (_rhs (HCons [] (HCons [] HNil))) | 123 | (_rhs ([], [])) |
121 | (\(b :: _) (c :: _) -> _rhs | 124 | (\(b :: _) (c :: _) -> _rhs |
122 | let d = _rhs (split c) in let e | 125 | let |
123 | = _rhs | 126 | d = _rhs (split c); |
124 | ((\(f :: _) -> hlistConsCase | 127 | e |
125 | _ | 128 | = _rhs |
126 | (\_ (g :: _) -> hlistConsCase _ (\(h :: _) (i :: _) -> hlistNilCase _ h i) g) | 129 | ((\(g :: _) -> hlistConsCase |
127 | f) | 130 | _ |
128 | d) in let j | 131 | (\_ (h :: _) -> hlistConsCase _ (\(i :: _) (j :: _) -> hlistNilCase _ i j) h) |
129 | = _rhs | 132 | g) |
130 | ((\(k :: _) -> hlistConsCase | 133 | d); |
131 | _ | 134 | f |
132 | (\(l :: _) (m :: _) -> hlistConsCase _ (\_ (n :: _) -> hlistNilCase _ l n) m) | 135 | = _rhs |
133 | k) | 136 | ((\(k :: _) -> hlistConsCase |
134 | d) in HCons (b : e) (HCons j HNil)) | 137 | _ |
138 | (\(l :: _) (m :: _) -> hlistConsCase _ (\_ (n :: _) -> hlistNilCase _ l n) m) | ||
139 | k) | ||
140 | d) | ||
141 | in (b : e, f)) | ||
135 | a | 142 | a |
136 | 143 | ||
137 | mergeBy | 144 | mergeBy |
@@ -158,7 +165,7 @@ sortBy | |||
158 | (_rhs []) | 165 | (_rhs []) |
159 | (\(c :: _) (d :: _) -> case'List | 166 | (\(c :: _) (d :: _) -> case'List |
160 | (\_ -> _) | 167 | (\_ -> _) |
161 | (_rhs (c : [])) | 168 | (_rhs [c]) |
162 | (\_ _ -> _rhs (uncurry (mergeBy a) ((sortBy a *** sortBy a) (split b)))) | 169 | (\_ _ -> _rhs (uncurry (mergeBy a) ((sortBy a *** sortBy a) (split b)))) |
163 | d) | 170 | d) |
164 | b | 171 | b |
@@ -217,7 +224,7 @@ sndTup = _rhs (hlistConsCase (_ :: _) \_ (a :: _) -> a) | |||
217 | 224 | ||
218 | project | 225 | project |
219 | :: forall (a :: _) (b :: [RecItem]) | 226 | :: forall (a :: _) (b :: [RecItem]) |
220 | . forall (c :: String) -> CW (isKeyC c a b) => RecordC b -> a | 227 | . forall (c :: String) -> isKeyC c a b => RecordC b -> a |
221 | project | 228 | project |
222 | = \ @(a :: _) @(b :: _) (c :: _) @_ (d :: _) -> case'List | 229 | = \ @(a :: _) @(b :: _) (c :: _) @_ (d :: _) -> case'List |
223 | (\_ -> _) | 230 | (\_ -> _) |
@@ -543,8 +550,12 @@ perspective | |||
543 | :: Float -> Float -> Float -> Float -> Mat (fromInt 4) (fromInt 4) Float | 550 | :: Float -> Float -> Float -> Float -> Mat (fromInt 4) (fromInt 4) Float |
544 | perspective | 551 | perspective |
545 | = \(a :: _) (b :: _) (c :: _) (d :: _) -> _rhs | 552 | = \(a :: _) (b :: _) (c :: _) (d :: _) -> _rhs |
546 | let e = _rhs (a * tan (c / fromInt 2)) in let f = _rhs (fromInt 0 - e) in let g | 553 | let |
547 | = _rhs (d * e) in let h = _rhs (fromInt 0 - g) in M44F | 554 | e = _rhs (a * tan (c / fromInt 2)); |
555 | f = _rhs (fromInt 0 - e); | ||
556 | g = _rhs (d * e); | ||
557 | h = _rhs (fromInt 0 - g) | ||
558 | in M44F | ||
548 | (V4 (fromInt 2 * a / (g - h)) (fromInt 0) (fromInt 0) (fromInt 0)) | 559 | (V4 (fromInt 2 * a / (g - h)) (fromInt 0) (fromInt 0) (fromInt 0)) |
549 | (V4 (fromInt 0) (fromInt 2 * a / (e - f)) (fromInt 0) (fromInt 0)) | 560 | (V4 (fromInt 0) (fromInt 2 * a / (e - f)) (fromInt 0) (fromInt 0)) |
550 | (V4 | 561 | (V4 |
@@ -560,7 +571,7 @@ perspective | |||
560 | 571 | ||
561 | rotMatrixZ | 572 | rotMatrixZ |
562 | = \(a :: _) -> _rhs | 573 | = \(a :: _) -> _rhs |
563 | let b = _rhs (cos a) in let c = _rhs (sin a) in M44F | 574 | let b = _rhs (cos a); c = _rhs (sin a) in M44F |
564 | (V4 b c (fromInt 0) (fromInt 0)) | 575 | (V4 b c (fromInt 0) (fromInt 0)) |
565 | (V4 (fromInt 0 - c) b (fromInt 0) (fromInt 0)) | 576 | (V4 (fromInt 0 - c) b (fromInt 0) (fromInt 0)) |
566 | (V4 (fromInt 0) (fromInt 0) (fromInt 1) (fromInt 0)) | 577 | (V4 (fromInt 0) (fromInt 0) (fromInt 1) (fromInt 0)) |
@@ -568,7 +579,7 @@ rotMatrixZ | |||
568 | 579 | ||
569 | rotMatrixY | 580 | rotMatrixY |
570 | = \(a :: _) -> _rhs | 581 | = \(a :: _) -> _rhs |
571 | let b = _rhs (cos a) in let c = _rhs (sin a) in M44F | 582 | let b = _rhs (cos a); c = _rhs (sin a) in M44F |
572 | (V4 b (fromInt 0) (fromInt 0 - c) (fromInt 0)) | 583 | (V4 b (fromInt 0) (fromInt 0 - c) (fromInt 0)) |
573 | (V4 (fromInt 0) (fromInt 1) (fromInt 0) (fromInt 0)) | 584 | (V4 (fromInt 0) (fromInt 1) (fromInt 0) (fromInt 0)) |
574 | (V4 c (fromInt 0) b (fromInt 0)) | 585 | (V4 c (fromInt 0) b (fromInt 0)) |
@@ -576,7 +587,7 @@ rotMatrixY | |||
576 | 587 | ||
577 | rotMatrixX | 588 | rotMatrixX |
578 | = \(a :: _) -> _rhs | 589 | = \(a :: _) -> _rhs |
579 | let b = _rhs (cos a) in let c = _rhs (sin a) in M44F | 590 | let b = _rhs (cos a); c = _rhs (sin a) in M44F |
580 | (V4 (fromInt 1) (fromInt 0) (fromInt 0) (fromInt 0)) | 591 | (V4 (fromInt 1) (fromInt 0) (fromInt 0) (fromInt 0)) |
581 | (V4 (fromInt 0) b c (fromInt 0)) | 592 | (V4 (fromInt 0) b c (fromInt 0)) |
582 | (V4 (fromInt 0) (fromInt 0 - c) b (fromInt 0)) | 593 | (V4 (fromInt 0) (fromInt 0 - c) b (fromInt 0)) |
@@ -589,15 +600,13 @@ rotationEuler | |||
589 | translateBefore4 :: Vec (fromInt 3) Float -> Mat (fromInt 4) (fromInt 4) Float | 600 | translateBefore4 :: Vec (fromInt 3) Float -> Mat (fromInt 4) (fromInt 4) Float |
590 | translateBefore4 | 601 | translateBefore4 |
591 | = \(a :: _) -> _rhs | 602 | = \(a :: _) -> _rhs |
592 | let b = _rhs (V4 (fromInt 1) (fromInt 0) (fromInt 0) (fromInt 0)) in let c | 603 | let |
593 | = _rhs (V4 (fromInt 0) (fromInt 1) (fromInt 0) (fromInt 0)) in let d | 604 | b = _rhs (V4 (fromInt 1) (fromInt 0) (fromInt 0) (fromInt 0)); |
594 | = _rhs (V4 (fromInt 0) (fromInt 0) (fromInt 1) (fromInt 0)) in let e | 605 | c = _rhs (V4 (fromInt 0) (fromInt 1) (fromInt 0) (fromInt 0)); |
595 | = _rhs | 606 | d = _rhs (V4 (fromInt 0) (fromInt 0) (fromInt 1) (fromInt 0)); |
596 | (V4 | 607 | e |
597 | (swizzscalar a Sx) | 608 | = _rhs (V4 (swizzscalar a Sx) (swizzscalar a Sy) (swizzscalar a Sz) (fromInt 1)) |
598 | (swizzscalar a Sy) | 609 | in M44F b c d e |
599 | (swizzscalar a Sz) | ||
600 | (fromInt 1)) in M44F b c d e | ||
601 | 610 | ||
602 | lookat | 611 | lookat |
603 | :: Vec (fromInt 3) Float | 612 | :: Vec (fromInt 3) Float |
@@ -605,22 +614,18 @@ lookat | |||
605 | -> Vec (fromInt 3) Float -> Mat (fromInt 4) (fromInt 4) Float | 614 | -> Vec (fromInt 3) Float -> Mat (fromInt 4) (fromInt 4) Float |
606 | lookat | 615 | lookat |
607 | = \(a :: _) (b :: _) (c :: _) -> _rhs | 616 | = \(a :: _) (b :: _) (c :: _) -> _rhs |
608 | let d | 617 | let |
609 | = \(e :: _) -> _rhs | 618 | d |
610 | (V4 | 619 | = \(i :: _) -> _rhs |
611 | (swizzscalar e Sx) | 620 | (V4 (swizzscalar i Sx) (swizzscalar i Sy) (swizzscalar i Sz) (fromInt 0)); |
612 | (swizzscalar e Sy) | 621 | e = _rhs (normalize $ a - b); |
613 | (swizzscalar e Sz) | 622 | f = _rhs (normalize $ c `cross` e); |
614 | (fromInt 0)) in let f = _rhs (normalize $ a - b) in let g | 623 | g = _rhs (e `cross` f); |
615 | = _rhs (normalize $ c `cross` f) in let h = _rhs (f `cross` g) in let i | 624 | h |
616 | = _rhs | 625 | = _rhs |
617 | (transpose | 626 | (transpose |
618 | $ M44F | 627 | $ M44F (d f) (d g) (d e) (V4 (fromInt 0) (fromInt 0) (fromInt 0) (fromInt 1))) |
619 | (d g) | 628 | in h .*. translateBefore4 (neg a) |
620 | (d h) | ||
621 | (d f) | ||
622 | (V4 (fromInt 0) (fromInt 0) (fromInt 0) (fromInt 1))) in i | ||
623 | .*. translateBefore4 (neg a) | ||
624 | 629 | ||
625 | scale = \(a :: _) (b :: _) -> _rhs (b * V4 a a a 1.0) | 630 | scale = \(a :: _) (b :: _) -> _rhs (b * V4 a a a 1.0) |
626 | 631 | ||