diff options
author | Péter Diviánszky <divipp@gmail.com> | 2016-05-10 16:32:23 +0200 |
---|---|---|
committer | Péter Diviánszky <divipp@gmail.com> | 2016-05-10 16:32:23 +0200 |
commit | 6ecef8f577432ffcaee07f09b2a73d4ea5eb5de2 (patch) | |
tree | 82ed1f4401c3cf2cd4910e5f2e62d0d3a8ac6904 /testdata/Prelude.out | |
parent | e061e1a91afc552fd7c3d7e5f7efb59746cc446f (diff) |
explicit lhs marks, first step
Diffstat (limited to 'testdata/Prelude.out')
-rw-r--r-- | testdata/Prelude.out | 834 |
1 files changed, 453 insertions, 381 deletions
diff --git a/testdata/Prelude.out b/testdata/Prelude.out index 556b39e2..ea497d05 100644 --- a/testdata/Prelude.out +++ b/testdata/Prelude.out | |||
@@ -12,208 +12,248 @@ infixr 3 *** | |||
12 | 12 | ||
13 | infixr 0 $ | 13 | infixr 0 $ |
14 | 14 | ||
15 | const = \(a :: _) (_ :: _) -> _rhs a | 15 | const = _lhs const \(a :: _) (_ :: _) -> _rhs a |
16 | 16 | ||
17 | otherwise = _rhs True | 17 | otherwise = _lhs otherwise (_rhs True) |
18 | 18 | ||
19 | (&) = \(a :: _) (b :: _) -> _rhs (b a) | 19 | (&) = _lhs (&) \(a :: _) (b :: _) -> _rhs (b a) |
20 | 20 | ||
21 | ($) = _rhs \(a :: _) (b :: _) -> a b | 21 | ($) = _lhs ($) (_rhs \(a :: _) (b :: _) -> a b) |
22 | 22 | ||
23 | (.) = _rhs \(a :: _) (b :: _) (c :: _) -> a (b c) | 23 | (.) = _lhs (.) (_rhs \(a :: _) (b :: _) (c :: _) -> a (b c)) |
24 | 24 | ||
25 | uncurry | 25 | uncurry |
26 | = \(a :: _) (b :: _) -> hlistConsCase | 26 | = _lhs |
27 | _ | 27 | uncurry |
28 | (\(c :: _) (d :: _) -> hlistConsCase | 28 | \(a :: _) (b :: _) -> hlistConsCase |
29 | _ | 29 | _ |
30 | (\(e :: _) (f :: _) -> hlistNilCase _ (_rhs (a c e)) f) | 30 | (\(c :: _) (d :: _) -> hlistConsCase |
31 | d) | 31 | _ |
32 | b | 32 | (\(e :: _) (f :: _) -> hlistNilCase _ (_rhs (a c e)) f) |
33 | d) | ||
34 | b | ||
33 | 35 | ||
34 | (***) | 36 | (***) |
35 | = \(a :: _) (b :: _) (c :: _) -> hlistConsCase | 37 | = _lhs |
36 | _ | 38 | (***) |
37 | (\(d :: _) (e :: _) -> hlistConsCase | 39 | \(a :: _) (b :: _) (c :: _) -> hlistConsCase |
38 | _ | 40 | _ |
39 | (\(f :: _) (g :: _) -> hlistNilCase _ (_rhs (a d, b f)) g) | 41 | (\(d :: _) (e :: _) -> hlistConsCase |
40 | e) | 42 | _ |
41 | c | 43 | (\(f :: _) (g :: _) -> hlistNilCase _ (_rhs (a d, b f)) g) |
44 | e) | ||
45 | c | ||
42 | 46 | ||
43 | pi = _rhs 3.141592653589793 | 47 | pi = _lhs pi (_rhs 3.141592653589793) |
44 | 48 | ||
45 | zip :: forall (a :: _) (b :: _) . [a] -> [b] -> [(a, b)] | 49 | zip :: forall (a :: _) (b :: _) . [a] -> [b] -> [(a, b)] |
46 | zip | 50 | zip |
47 | = \(a :: _) (b :: _) -> case'List | 51 | = _lhs |
48 | (\(_ :: _) -> _) | 52 | zip |
49 | (_rhs []) | 53 | \(a :: _) (b :: _) -> case'List |
50 | (\(c :: _) (d :: _) -> case'List | ||
51 | (\(_ :: _) -> _) | 54 | (\(_ :: _) -> _) |
52 | (_rhs []) | 55 | (_rhs []) |
53 | (\(e :: _) (f :: _) -> _rhs ((c, e) : zip d f)) | 56 | (\(c :: _) (d :: _) -> case'List |
54 | b) | 57 | (\(_ :: _) -> _) |
55 | a | 58 | (_rhs []) |
59 | (\(e :: _) (f :: _) -> _rhs ((c, e) : zip d f)) | ||
60 | b) | ||
61 | a | ||
56 | 62 | ||
57 | unzip :: forall (a :: _) (b :: _) . [(a, b)] -> ([a], [b]) | 63 | unzip :: forall (a :: _) (b :: _) . [(a, b)] -> ([a], [b]) |
58 | unzip | 64 | unzip |
59 | = \(a :: _) -> case'List | 65 | = _lhs |
60 | (\(_ :: _) -> _) | 66 | unzip |
61 | (_rhs ([], [])) | 67 | \(a :: _) -> case'List |
62 | (\(b :: _) (c :: _) -> hlistConsCase | 68 | (\(_ :: _) -> _) |
63 | _ | 69 | (_rhs ([], [])) |
64 | (\(d :: _) (e :: _) -> hlistConsCase | 70 | (\(b :: _) (c :: _) -> hlistConsCase |
65 | _ | 71 | _ |
66 | (\(f :: _) (g :: _) -> hlistNilCase | 72 | (\(d :: _) (e :: _) -> hlistConsCase |
67 | _ | 73 | _ |
68 | (_rhs | 74 | (\(f :: _) (g :: _) -> hlistNilCase |
69 | let | 75 | _ |
70 | h = _rhs (unzip c); | 76 | (_rhs |
71 | i | 77 | let |
72 | = _rhs | 78 | h = _lhs _bs_as (_rhs (unzip c)); |
73 | ((\(k :: _) -> hlistConsCase | 79 | i |
74 | _ | 80 | = _lhs |
75 | (\(_ :: _) (l :: _) -> hlistConsCase | 81 | bs |
76 | _ | 82 | (_rhs |
77 | (\(m :: _) (n :: _) -> hlistNilCase _ m n) | 83 | ((\(k :: _) -> hlistConsCase |
78 | l) | 84 | _ |
79 | k) | 85 | (\(_ :: _) (l :: _) -> hlistConsCase |
80 | h); | 86 | _ |
81 | j | 87 | (\(m :: _) (n :: _) -> hlistNilCase _ m n) |
82 | = _rhs | 88 | l) |
83 | ((\(o :: _) -> hlistConsCase | 89 | k) |
84 | _ | 90 | h)); |
85 | (\(p :: _) (q :: _) -> hlistConsCase | 91 | j |
86 | _ | 92 | = _lhs |
87 | (\(_ :: _) (r :: _) -> hlistNilCase _ p r) | 93 | as |
88 | q) | 94 | (_rhs |
89 | o) | 95 | ((\(o :: _) -> hlistConsCase |
90 | h) | 96 | _ |
91 | in (d : j, f : i)) | 97 | (\(p :: _) (q :: _) -> hlistConsCase |
92 | g) | 98 | _ |
93 | e) | 99 | (\(_ :: _) (r :: _) -> hlistNilCase _ p r) |
94 | b) | 100 | q) |
95 | a | 101 | o) |
102 | h)) | ||
103 | in (d : j, f : i)) | ||
104 | g) | ||
105 | e) | ||
106 | b) | ||
107 | a | ||
96 | 108 | ||
97 | filter | 109 | filter |
98 | = \(a :: _) (b :: _) -> case'List | 110 | = _lhs |
99 | (\(_ :: _) -> _) | 111 | filter |
100 | (_rhs []) | 112 | \(a :: _) (b :: _) -> case'List |
101 | (\(c :: _) (d :: _) -> _rhs | 113 | (\(_ :: _) -> _) |
102 | ((\(e :: _) -> case'Bool (\(_ :: _) -> _) (filter a d) (c : filter a d) e) | 114 | (_rhs []) |
103 | (a c))) | 115 | (\(c :: _) (d :: _) -> _rhs |
104 | b | 116 | ((\(e :: _) -> case'Bool (\(_ :: _) -> _) (filter a d) (c : filter a d) e) |
117 | (a c))) | ||
118 | b | ||
105 | 119 | ||
106 | tail :: forall (a :: _) . [a] -> [a] | 120 | tail :: forall (a :: _) . [a] -> [a] |
107 | tail | 121 | tail |
108 | = \(a :: _) -> case'List | 122 | = _lhs |
109 | (\(_ :: _) -> _) | 123 | tail |
110 | (_rhs undefined) | 124 | \(a :: _) -> case'List |
111 | (\(_ :: _) (b :: _) -> _rhs b) | 125 | (\(_ :: _) -> _) |
112 | a | 126 | (_rhs undefined) |
127 | (\(_ :: _) (b :: _) -> _rhs b) | ||
128 | a | ||
113 | 129 | ||
114 | pairs :: forall (a :: _) . [a] -> [(a, a)] | 130 | pairs :: forall (a :: _) . [a] -> [(a, a)] |
115 | pairs = \(a :: _) -> _rhs (zip a (tail a)) | 131 | pairs = _lhs pairs \(a :: _) -> _rhs (zip a (tail a)) |
116 | 132 | ||
117 | foldl' | 133 | foldl' |
118 | = \(a :: _) (b :: _) (c :: _) -> case'List | 134 | = _lhs |
119 | (\(_ :: _) -> _) | 135 | foldl' |
120 | (_rhs b) | 136 | \(a :: _) (b :: _) (c :: _) -> case'List |
121 | (\(d :: _) (e :: _) -> _rhs (foldl' a (a b d) e)) | 137 | (\(_ :: _) -> _) |
122 | c | 138 | (_rhs b) |
139 | (\(d :: _) (e :: _) -> _rhs (foldl' a (a b d) e)) | ||
140 | c | ||
123 | 141 | ||
124 | foldr1 | 142 | foldr1 |
125 | = \(a :: _) (b :: _) -> case'List | 143 | = _lhs |
126 | (\(_ :: _) -> _) | 144 | foldr1 |
127 | (_rhs undefined) | 145 | \(a :: _) (b :: _) -> case'List |
128 | (\(c :: _) (d :: _) -> _rhs (foldr a c d)) | 146 | (\(_ :: _) -> _) |
129 | b | 147 | (_rhs undefined) |
148 | (\(c :: _) (d :: _) -> _rhs (foldr a c d)) | ||
149 | b | ||
130 | 150 | ||
131 | split | 151 | split |
132 | = \(a :: _) -> case'List | 152 | = _lhs |
133 | (\(_ :: _) -> _) | 153 | split |
134 | (_rhs ([], [])) | 154 | \(a :: _) -> case'List |
135 | (\(b :: _) (c :: _) -> _rhs | 155 | (\(_ :: _) -> _) |
136 | let | 156 | (_rhs ([], [])) |
137 | d = _rhs (split c); | 157 | (\(b :: _) (c :: _) -> _rhs |
138 | e | 158 | let |
139 | = _rhs | 159 | d = _lhs _bs_as (_rhs (split c)); |
140 | ((\(g :: _) -> hlistConsCase | 160 | e |
141 | _ | 161 | = _lhs |
142 | (\(_ :: _) (h :: _) -> hlistConsCase | 162 | bs |
143 | _ | 163 | (_rhs |
144 | (\(i :: _) (j :: _) -> hlistNilCase _ i j) | 164 | ((\(g :: _) -> hlistConsCase |
145 | h) | 165 | _ |
146 | g) | 166 | (\(_ :: _) (h :: _) -> hlistConsCase |
147 | d); | 167 | _ |
148 | f | 168 | (\(i :: _) (j :: _) -> hlistNilCase _ i j) |
149 | = _rhs | 169 | h) |
150 | ((\(k :: _) -> hlistConsCase | 170 | g) |
151 | _ | 171 | d)); |
152 | (\(l :: _) (m :: _) -> hlistConsCase | 172 | f |
153 | _ | 173 | = _lhs |
154 | (\(_ :: _) (n :: _) -> hlistNilCase _ l n) | 174 | as |
155 | m) | 175 | (_rhs |
156 | k) | 176 | ((\(k :: _) -> hlistConsCase |
157 | d) | 177 | _ |
158 | in (b : e, f)) | 178 | (\(l :: _) (m :: _) -> hlistConsCase |
159 | a | 179 | _ |
180 | (\(_ :: _) (n :: _) -> hlistNilCase _ l n) | ||
181 | m) | ||
182 | k) | ||
183 | d)) | ||
184 | in (b : e, f)) | ||
185 | a | ||
160 | 186 | ||
161 | mergeBy | 187 | mergeBy |
162 | = \(a :: _) (b :: _) (c :: _) -> case'List | 188 | = _lhs |
163 | (\(_ :: _) -> _) | 189 | mergeBy |
164 | (_rhs c) | 190 | \(a :: _) (b :: _) (c :: _) -> case'List |
165 | (\(d :: _) (e :: _) -> case'List | ||
166 | (\(_ :: _) -> _) | 191 | (\(_ :: _) -> _) |
167 | (_rhs b) | 192 | (_rhs c) |
168 | (\(f :: _) (g :: _) -> _rhs | 193 | (\(d :: _) (e :: _) -> case'List |
169 | ((\(h :: _) -> case'Ordering | 194 | (\(_ :: _) -> _) |
170 | (\(_ :: _) -> _) | 195 | (_rhs b) |
171 | (d : mergeBy a e (f : g)) | 196 | (\(f :: _) (g :: _) -> _rhs |
172 | (f : mergeBy a (d : e) g) | 197 | ((\(h :: _) -> case'Ordering |
173 | (f : mergeBy a (d : e) g) | 198 | (\(_ :: _) -> _) |
174 | h) | 199 | (d : mergeBy a e (f : g)) |
175 | (a d f))) | 200 | (f : mergeBy a (d : e) g) |
176 | c) | 201 | (f : mergeBy a (d : e) g) |
177 | b | 202 | h) |
203 | (a d f))) | ||
204 | c) | ||
205 | b | ||
178 | 206 | ||
179 | sortBy | 207 | sortBy |
180 | = \(a :: _) (b :: _) -> case'List | 208 | = _lhs |
181 | (\(_ :: _) -> _) | 209 | sortBy |
182 | (_rhs []) | 210 | \(a :: _) (b :: _) -> case'List |
183 | (\(c :: _) (d :: _) -> case'List | ||
184 | (\(_ :: _) -> _) | 211 | (\(_ :: _) -> _) |
185 | (_rhs [c]) | 212 | (_rhs []) |
186 | (\(_ :: _) (_ :: _) -> _rhs | 213 | (\(c :: _) (d :: _) -> case'List |
187 | (uncurry (mergeBy a) ((sortBy a *** sortBy a) (split b)))) | 214 | (\(_ :: _) -> _) |
188 | d) | 215 | (_rhs [c]) |
189 | b | 216 | (\(_ :: _) (_ :: _) -> _rhs |
217 | (uncurry (mergeBy a) ((sortBy a *** sortBy a) (split b)))) | ||
218 | d) | ||
219 | b | ||
190 | 220 | ||
191 | iterate :: forall (a :: _) . (a -> a) -> a -> [a] | 221 | iterate :: forall (a :: _) . (a -> a) -> a -> [a] |
192 | iterate = \(a :: _) (b :: _) -> _rhs (b : iterate a (a b)) | 222 | iterate = _lhs iterate \(a :: _) (b :: _) -> _rhs (b : iterate a (a b)) |
193 | 223 | ||
194 | fst | 224 | fst |
195 | = \(a :: _) -> hlistConsCase | 225 | = _lhs |
196 | _ | 226 | fst |
197 | (\(b :: _) (c :: _) -> hlistConsCase | 227 | \(a :: _) -> hlistConsCase |
198 | _ | 228 | _ |
199 | (\(_ :: _) (d :: _) -> hlistNilCase _ (_rhs b) d) | 229 | (\(b :: _) (c :: _) -> hlistConsCase |
200 | c) | 230 | _ |
201 | a | 231 | (\(_ :: _) (d :: _) -> hlistNilCase _ (_rhs b) d) |
232 | c) | ||
233 | a | ||
202 | 234 | ||
203 | snd | 235 | snd |
204 | = \(a :: _) -> hlistConsCase | 236 | = _lhs |
205 | _ | 237 | snd |
206 | (\(_ :: _) (b :: _) -> hlistConsCase | 238 | \(a :: _) -> hlistConsCase |
207 | _ | 239 | _ |
208 | (\(c :: _) (d :: _) -> hlistNilCase _ (_rhs c) d) | 240 | (\(_ :: _) (b :: _) -> hlistConsCase |
209 | b) | 241 | _ |
210 | a | 242 | (\(c :: _) (d :: _) -> hlistNilCase _ (_rhs c) d) |
243 | b) | ||
244 | a | ||
211 | 245 | ||
212 | (|||) = \(a :: _) (b :: _) -> case'Bool (\(_ :: _) -> _) (_rhs b) (_rhs True) a | 246 | (|||) |
247 | = _lhs | ||
248 | (|||) | ||
249 | \(a :: _) (b :: _) -> case'Bool (\(_ :: _) -> _) (_rhs b) (_rhs True) a | ||
213 | 250 | ||
214 | infixr 2 ||| | 251 | infixr 2 ||| |
215 | 252 | ||
216 | (&&&) = \(a :: _) (b :: _) -> case'Bool (\(_ :: _) -> _) (_rhs False) (_rhs b) a | 253 | (&&&) |
254 | = _lhs | ||
255 | (&&&) | ||
256 | \(a :: _) (b :: _) -> case'Bool (\(_ :: _) -> _) (_rhs False) (_rhs b) a | ||
217 | 257 | ||
218 | infixr 3 &&& | 258 | infixr 3 &&& |
219 | 259 | ||
@@ -221,255 +261,263 @@ data RecItem :: Type where | |||
221 | RecItem :: String -> Type -> RecItem | 261 | RecItem :: String -> Type -> RecItem |
222 | 262 | ||
223 | recItemType | 263 | recItemType |
224 | = \(a :: _) -> case'RecItem (\(_ :: _) -> _) (\(_ :: _) (b :: _) -> _rhs b) a | 264 | = _lhs |
265 | recItemType | ||
266 | \(a :: _) -> case'RecItem (\(_ :: _) -> _) (\(_ :: _) (b :: _) -> _rhs b) a | ||
225 | 267 | ||
226 | data RecordC (_ :: [RecItem]) :: Type where | 268 | data RecordC (_ :: [RecItem]) :: Type where |
227 | RecordCons :: forall (a :: [RecItem]) . HList (map recItemType a) -> RecordC a | 269 | RecordCons :: forall (a :: [RecItem]) . HList (map recItemType a) -> RecordC a |
228 | 270 | ||
229 | isKeyC | 271 | isKeyC |
230 | = \(a :: _) (b :: _) (c :: _) -> case'List | 272 | = _lhs |
231 | (\(_ :: _) -> _) | 273 | isKeyC |
232 | (_rhs ('CEmpty "")) | 274 | \(a :: _) (b :: _) (c :: _) -> case'List |
233 | (\(d :: _) (e :: _) -> case'RecItem | ||
234 | (\(_ :: _) -> _) | 275 | (\(_ :: _) -> _) |
235 | (\(f :: _) (g :: _) -> _rhs | 276 | (_rhs ('CEmpty "")) |
236 | (primIfThenElse (a == f) (b `'EqCTt` g) (isKeyC a b e))) | 277 | (\(d :: _) (e :: _) -> case'RecItem |
237 | d) | 278 | (\(_ :: _) -> _) |
238 | c | 279 | (\(f :: _) (g :: _) -> _rhs |
280 | (primIfThenElse (a == f) (b `'EqCTt` g) (isKeyC a b e))) | ||
281 | d) | ||
282 | c | ||
239 | 283 | ||
240 | fstTup = _rhs (hlistConsCase (_ :: _) \(a :: _) (_ :: _) -> a) | 284 | fstTup = _lhs fstTup (_rhs (hlistConsCase (_ :: _) \(a :: _) (_ :: _) -> a)) |
241 | 285 | ||
242 | sndTup = _rhs (hlistConsCase (_ :: _) \(_ :: _) (a :: _) -> a) | 286 | sndTup = _lhs sndTup (_rhs (hlistConsCase (_ :: _) \(_ :: _) (a :: _) -> a)) |
243 | 287 | ||
244 | project | 288 | project |
245 | :: forall (a :: _) (b :: [RecItem]) | 289 | :: forall (a :: _) (b :: [RecItem]) |
246 | . forall (c :: String) -> isKeyC c a b => RecordC b -> a | 290 | . forall (c :: String) -> isKeyC c a b => RecordC b -> a |
247 | project | 291 | project |
248 | = \ @(a :: _) @(b :: _) (c :: _) @(_ :: _) (d :: _) -> case'List | 292 | = _lhs |
249 | (\(_ :: _) -> _) | 293 | project |
250 | (_rhs undefined) | 294 | \ @(a :: _) @(b :: _) (c :: _) @(_ :: _) (d :: _) -> case'List |
251 | (\(e :: _) (f :: _) -> case'RecItem | ||
252 | (\(_ :: _) -> _) | 295 | (\(_ :: _) -> _) |
253 | (\(g :: _) (_ :: _) -> case'RecordC | 296 | (_rhs undefined) |
297 | (\(e :: _) (f :: _) -> case'RecItem | ||
254 | (\(_ :: _) -> _) | 298 | (\(_ :: _) -> _) |
255 | (\(h :: _) -> case'Bool | 299 | (\(g :: _) (_ :: _) -> case'RecordC |
256 | (\(_ :: _) -> _) | 300 | (\(_ :: _) -> _) |
257 | (_rhs | 301 | (\(h :: _) -> case'Bool |
258 | (project | 302 | (\(_ :: _) -> _) |
259 | @a | 303 | (_rhs |
260 | @f | 304 | (project |
261 | c | 305 | @a |
262 | @(undefined @('CW (isKeyC c a f))) | 306 | @f |
263 | (RecordCons | 307 | c |
264 | (sndTup (unsafeCoerce @(_ :: _) @('HList (a : map recItemType f)) h))))) | 308 | @(undefined @('CW (isKeyC c a f))) |
265 | (_rhs (fstTup (unsafeCoerce @(_ :: _) @('HList (a : map recItemType f)) h))) | 309 | (RecordCons |
266 | (c == g)) | 310 | (sndTup (unsafeCoerce @(_ :: _) @('HList (a : map recItemType f)) h))))) |
267 | d) | 311 | (_rhs (fstTup (unsafeCoerce @(_ :: _) @('HList (a : map recItemType f)) h))) |
268 | e) | 312 | (c == g)) |
269 | b | 313 | d) |
314 | e) | ||
315 | b | ||
270 | 316 | ||
271 | rgb = \(a :: _) (b :: _) (c :: _) -> _rhs (V4 a b c 1.0) | 317 | rgb = _lhs rgb \(a :: _) (b :: _) (c :: _) -> _rhs (V4 a b c 1.0) |
272 | 318 | ||
273 | black = _rhs (rgb 0.0 0.0 0.0) | 319 | black = _lhs black (_rhs (rgb 0.0 0.0 0.0)) |
274 | 320 | ||
275 | gray = _rhs (rgb 0.5 0.5 0.5) | 321 | gray = _lhs gray (_rhs (rgb 0.5 0.5 0.5)) |
276 | 322 | ||
277 | silver = _rhs (rgb 0.75 0.75 0.75) | 323 | silver = _lhs silver (_rhs (rgb 0.75 0.75 0.75)) |
278 | 324 | ||
279 | white = _rhs (rgb 1.0 1.0 1.0) | 325 | white = _lhs white (_rhs (rgb 1.0 1.0 1.0)) |
280 | 326 | ||
281 | maroon = _rhs (rgb 0.5 0.0 0.0) | 327 | maroon = _lhs maroon (_rhs (rgb 0.5 0.0 0.0)) |
282 | 328 | ||
283 | red = _rhs (rgb 1.0 0.0 0.0) | 329 | red = _lhs red (_rhs (rgb 1.0 0.0 0.0)) |
284 | 330 | ||
285 | olive = _rhs (rgb 0.5 0.5 0.0) | 331 | olive = _lhs olive (_rhs (rgb 0.5 0.5 0.0)) |
286 | 332 | ||
287 | yellow = _rhs (rgb 1.0 1.0 0.0) | 333 | yellow = _lhs yellow (_rhs (rgb 1.0 1.0 0.0)) |
288 | 334 | ||
289 | green = _rhs (rgb 0.0 0.5 0.0) | 335 | green = _lhs green (_rhs (rgb 0.0 0.5 0.0)) |
290 | 336 | ||
291 | lime = _rhs (rgb 0.0 1.0 0.0) | 337 | lime = _lhs lime (_rhs (rgb 0.0 1.0 0.0)) |
292 | 338 | ||
293 | teal = _rhs (rgb 0.0 0.5 0.5) | 339 | teal = _lhs teal (_rhs (rgb 0.0 0.5 0.5)) |
294 | 340 | ||
295 | aqua = _rhs (rgb 0.0 1.0 1.0) | 341 | aqua = _lhs aqua (_rhs (rgb 0.0 1.0 1.0)) |
296 | 342 | ||
297 | navy = _rhs (rgb 0.0 0.0 0.5) | 343 | navy = _lhs navy (_rhs (rgb 0.0 0.0 0.5)) |
298 | 344 | ||
299 | blue = _rhs (rgb 0.0 0.0 1.0) | 345 | blue = _lhs blue (_rhs (rgb 0.0 0.0 1.0)) |
300 | 346 | ||
301 | purple = _rhs (rgb 0.5 0.0 0.5) | 347 | purple = _lhs purple (_rhs (rgb 0.5 0.0 0.5)) |
302 | 348 | ||
303 | fuchsia = _rhs (rgb 1.0 0.0 1.0) | 349 | fuchsia = _lhs fuchsia (_rhs (rgb 1.0 0.0 1.0)) |
304 | 350 | ||
305 | colorImage1 = _rhs (ColorImage @(fromInt 1)) | 351 | colorImage1 = _lhs colorImage1 (_rhs (ColorImage @(fromInt 1))) |
306 | 352 | ||
307 | colorImage2 = _rhs (ColorImage @(fromInt 2)) | 353 | colorImage2 = _lhs colorImage2 (_rhs (ColorImage @(fromInt 2))) |
308 | 354 | ||
309 | depthImage1 = _rhs (DepthImage @(fromInt 1)) | 355 | depthImage1 = _lhs depthImage1 (_rhs (DepthImage @(fromInt 1))) |
310 | 356 | ||
311 | v3FToV4F :: Vec (fromInt 3) Float -> Vec (fromInt 4) Float | 357 | v3FToV4F :: Vec (fromInt 3) Float -> Vec (fromInt 4) Float |
312 | v3FToV4F | 358 | v3FToV4F |
313 | = \(a :: _) -> _rhs | 359 | = _lhs |
314 | (V4 (swizzscalar a Sx) (swizzscalar a Sy) (swizzscalar a Sz) (fromInt 1)) | 360 | v3FToV4F |
361 | \(a :: _) -> _rhs | ||
362 | (V4 (swizzscalar a Sx) (swizzscalar a Sy) (swizzscalar a Sz) (fromInt 1)) | ||
315 | 363 | ||
316 | radians = _rhs PrimRadians | 364 | radians = _lhs radians (_rhs PrimRadians) |
317 | 365 | ||
318 | degrees = _rhs PrimDegrees | 366 | degrees = _lhs degrees (_rhs PrimDegrees) |
319 | 367 | ||
320 | sin = _rhs PrimSin | 368 | sin = _lhs sin (_rhs PrimSin) |
321 | 369 | ||
322 | cos = _rhs PrimCos | 370 | cos = _lhs cos (_rhs PrimCos) |
323 | 371 | ||
324 | tan = _rhs PrimTan | 372 | tan = _lhs tan (_rhs PrimTan) |
325 | 373 | ||
326 | sinh = _rhs PrimSinH | 374 | sinh = _lhs sinh (_rhs PrimSinH) |
327 | 375 | ||
328 | cosh = _rhs PrimCosH | 376 | cosh = _lhs cosh (_rhs PrimCosH) |
329 | 377 | ||
330 | tanh = _rhs PrimTanH | 378 | tanh = _lhs tanh (_rhs PrimTanH) |
331 | 379 | ||
332 | asin = _rhs PrimASin | 380 | asin = _lhs asin (_rhs PrimASin) |
333 | 381 | ||
334 | asinh = _rhs PrimASinH | 382 | asinh = _lhs asinh (_rhs PrimASinH) |
335 | 383 | ||
336 | acos = _rhs PrimACos | 384 | acos = _lhs acos (_rhs PrimACos) |
337 | 385 | ||
338 | acosh = _rhs PrimACosH | 386 | acosh = _lhs acosh (_rhs PrimACosH) |
339 | 387 | ||
340 | atan = _rhs PrimATan | 388 | atan = _lhs atan (_rhs PrimATan) |
341 | 389 | ||
342 | atanh = _rhs PrimATanH | 390 | atanh = _lhs atanh (_rhs PrimATanH) |
343 | 391 | ||
344 | atan2 = _rhs PrimATan2 | 392 | atan2 = _lhs atan2 (_rhs PrimATan2) |
345 | 393 | ||
346 | pow = _rhs PrimPow | 394 | pow = _lhs pow (_rhs PrimPow) |
347 | 395 | ||
348 | exp = _rhs PrimExp | 396 | exp = _lhs exp (_rhs PrimExp) |
349 | 397 | ||
350 | log = _rhs PrimLog | 398 | log = _lhs log (_rhs PrimLog) |
351 | 399 | ||
352 | exp2 = _rhs PrimExp2 | 400 | exp2 = _lhs exp2 (_rhs PrimExp2) |
353 | 401 | ||
354 | log2 = _rhs PrimLog2 | 402 | log2 = _lhs log2 (_rhs PrimLog2) |
355 | 403 | ||
356 | sqrt = _rhs PrimSqrt | 404 | sqrt = _lhs sqrt (_rhs PrimSqrt) |
357 | 405 | ||
358 | inversesqrt = _rhs PrimInvSqrt | 406 | inversesqrt = _lhs inversesqrt (_rhs PrimInvSqrt) |
359 | 407 | ||
360 | abs = _rhs PrimAbs | 408 | abs = _lhs abs (_rhs PrimAbs) |
361 | 409 | ||
362 | sign = _rhs PrimSign | 410 | sign = _lhs sign (_rhs PrimSign) |
363 | 411 | ||
364 | floor = _rhs PrimFloor | 412 | floor = _lhs floor (_rhs PrimFloor) |
365 | 413 | ||
366 | trunc = _rhs PrimTrunc | 414 | trunc = _lhs trunc (_rhs PrimTrunc) |
367 | 415 | ||
368 | round = _rhs PrimRound | 416 | round = _lhs round (_rhs PrimRound) |
369 | 417 | ||
370 | roundEven = _rhs PrimRoundEven | 418 | roundEven = _lhs roundEven (_rhs PrimRoundEven) |
371 | 419 | ||
372 | ceil = _rhs PrimCeil | 420 | ceil = _lhs ceil (_rhs PrimCeil) |
373 | 421 | ||
374 | fract = _rhs PrimFract | 422 | fract = _lhs fract (_rhs PrimFract) |
375 | 423 | ||
376 | mod = _rhs PrimMod | 424 | mod = _lhs mod (_rhs PrimMod) |
377 | 425 | ||
378 | min = _rhs PrimMin | 426 | min = _lhs min (_rhs PrimMin) |
379 | 427 | ||
380 | max = _rhs PrimMax | 428 | max = _lhs max (_rhs PrimMax) |
381 | 429 | ||
382 | modF = _rhs PrimModF | 430 | modF = _lhs modF (_rhs PrimModF) |
383 | 431 | ||
384 | clamp = _rhs PrimClamp | 432 | clamp = _lhs clamp (_rhs PrimClamp) |
385 | 433 | ||
386 | clampS = _rhs PrimClampS | 434 | clampS = _lhs clampS (_rhs PrimClampS) |
387 | 435 | ||
388 | mix = _rhs PrimMix | 436 | mix = _lhs mix (_rhs PrimMix) |
389 | 437 | ||
390 | mixS = _rhs PrimMixS | 438 | mixS = _lhs mixS (_rhs PrimMixS) |
391 | 439 | ||
392 | mixB = _rhs PrimMixB | 440 | mixB = _lhs mixB (_rhs PrimMixB) |
393 | 441 | ||
394 | step = _rhs PrimStep | 442 | step = _lhs step (_rhs PrimStep) |
395 | 443 | ||
396 | stepS = _rhs PrimStepS | 444 | stepS = _lhs stepS (_rhs PrimStepS) |
397 | 445 | ||
398 | smoothstep = _rhs PrimSmoothStep | 446 | smoothstep = _lhs smoothstep (_rhs PrimSmoothStep) |
399 | 447 | ||
400 | smoothstepS = _rhs PrimSmoothStepS | 448 | smoothstepS = _lhs smoothstepS (_rhs PrimSmoothStepS) |
401 | 449 | ||
402 | isNan = _rhs PrimIsNan | 450 | isNan = _lhs isNan (_rhs PrimIsNan) |
403 | 451 | ||
404 | isInf = _rhs PrimIsInf | 452 | isInf = _lhs isInf (_rhs PrimIsInf) |
405 | 453 | ||
406 | dFdx = _rhs PrimDFdx | 454 | dFdx = _lhs dFdx (_rhs PrimDFdx) |
407 | 455 | ||
408 | dFdy = _rhs PrimDFdy | 456 | dFdy = _lhs dFdy (_rhs PrimDFdy) |
409 | 457 | ||
410 | fWidth = _rhs PrimFWidth | 458 | fWidth = _lhs fWidth (_rhs PrimFWidth) |
411 | 459 | ||
412 | noise1 = _rhs PrimNoise1 | 460 | noise1 = _lhs noise1 (_rhs PrimNoise1) |
413 | 461 | ||
414 | noise2 = _rhs PrimNoise2 | 462 | noise2 = _lhs noise2 (_rhs PrimNoise2) |
415 | 463 | ||
416 | noise3 = _rhs PrimNoise3 | 464 | noise3 = _lhs noise3 (_rhs PrimNoise3) |
417 | 465 | ||
418 | noise4 = _rhs PrimNoise4 | 466 | noise4 = _lhs noise4 (_rhs PrimNoise4) |
419 | 467 | ||
420 | length = _rhs PrimLength | 468 | length = _lhs length (_rhs PrimLength) |
421 | 469 | ||
422 | distance = _rhs PrimDistance | 470 | distance = _lhs distance (_rhs PrimDistance) |
423 | 471 | ||
424 | dot = _rhs PrimDot | 472 | dot = _lhs dot (_rhs PrimDot) |
425 | 473 | ||
426 | cross = _rhs PrimCross | 474 | cross = _lhs cross (_rhs PrimCross) |
427 | 475 | ||
428 | normalize = _rhs PrimNormalize | 476 | normalize = _lhs normalize (_rhs PrimNormalize) |
429 | 477 | ||
430 | faceforward = _rhs PrimFaceForward | 478 | faceforward = _lhs faceforward (_rhs PrimFaceForward) |
431 | 479 | ||
432 | reflect = _rhs PrimReflect | 480 | reflect = _lhs reflect (_rhs PrimReflect) |
433 | 481 | ||
434 | refract = _rhs PrimRefract | 482 | refract = _lhs refract (_rhs PrimRefract) |
435 | 483 | ||
436 | transpose = _rhs PrimTranspose | 484 | transpose = _lhs transpose (_rhs PrimTranspose) |
437 | 485 | ||
438 | det = _rhs PrimDeterminant | 486 | det = _lhs det (_rhs PrimDeterminant) |
439 | 487 | ||
440 | inv = _rhs PrimInverse | 488 | inv = _lhs inv (_rhs PrimInverse) |
441 | 489 | ||
442 | outer = _rhs PrimOuterProduct | 490 | outer = _lhs outer (_rhs PrimOuterProduct) |
443 | 491 | ||
444 | bAnd = _rhs PrimBAnd | 492 | bAnd = _lhs bAnd (_rhs PrimBAnd) |
445 | 493 | ||
446 | bOr = _rhs PrimBOr | 494 | bOr = _lhs bOr (_rhs PrimBOr) |
447 | 495 | ||
448 | bXor = _rhs PrimBXor | 496 | bXor = _lhs bXor (_rhs PrimBXor) |
449 | 497 | ||
450 | bNot = _rhs PrimBNot | 498 | bNot = _lhs bNot (_rhs PrimBNot) |
451 | 499 | ||
452 | bAndS = _rhs PrimBAndS | 500 | bAndS = _lhs bAndS (_rhs PrimBAndS) |
453 | 501 | ||
454 | bOrS = _rhs PrimBOrS | 502 | bOrS = _lhs bOrS (_rhs PrimBOrS) |
455 | 503 | ||
456 | bXorS = _rhs PrimBXorS | 504 | bXorS = _lhs bXorS (_rhs PrimBXorS) |
457 | 505 | ||
458 | shiftL = _rhs PrimBShiftL | 506 | shiftL = _lhs shiftL (_rhs PrimBShiftL) |
459 | 507 | ||
460 | shiftR = _rhs PrimBShiftR | 508 | shiftR = _lhs shiftR (_rhs PrimBShiftR) |
461 | 509 | ||
462 | shiftLS = _rhs PrimBShiftLS | 510 | shiftLS = _lhs shiftLS (_rhs PrimBShiftLS) |
463 | 511 | ||
464 | shiftRS = _rhs PrimBShiftRS | 512 | shiftRS = _lhs shiftRS (_rhs PrimBShiftRS) |
465 | 513 | ||
466 | floatBitsToInt = _rhs PrimFloatBitsToInt | 514 | floatBitsToInt = _lhs floatBitsToInt (_rhs PrimFloatBitsToInt) |
467 | 515 | ||
468 | floatBitsToWord = _rhs PrimFloatBitsToUInt | 516 | floatBitsToWord = _lhs floatBitsToWord (_rhs PrimFloatBitsToUInt) |
469 | 517 | ||
470 | intBitsToFloat = _rhs PrimIntBitsToFloat | 518 | intBitsToFloat = _lhs intBitsToFloat (_rhs PrimIntBitsToFloat) |
471 | 519 | ||
472 | wordBitsToFloat = _rhs PrimUIntBitsToFloat | 520 | wordBitsToFloat = _lhs wordBitsToFloat (_rhs PrimUIntBitsToFloat) |
473 | 521 | ||
474 | infixl 7 * | 522 | infixl 7 * |
475 | 523 | ||
@@ -505,45 +553,45 @@ infixl 7 .* | |||
505 | 553 | ||
506 | infixl 7 .*. | 554 | infixl 7 .*. |
507 | 555 | ||
508 | (+) = \(a :: _) (b :: _) -> _rhs (PrimAdd a b) | 556 | (+) = _lhs (+) \(a :: _) (b :: _) -> _rhs (PrimAdd a b) |
509 | 557 | ||
510 | (-) = \(a :: _) (b :: _) -> _rhs (PrimSub a b) | 558 | (-) = _lhs (-) \(a :: _) (b :: _) -> _rhs (PrimSub a b) |
511 | 559 | ||
512 | (*) = \(a :: _) (b :: _) -> _rhs (PrimMul a b) | 560 | (*) = _lhs (*) \(a :: _) (b :: _) -> _rhs (PrimMul a b) |
513 | 561 | ||
514 | (/) = \(a :: _) (b :: _) -> _rhs (PrimDiv a b) | 562 | (/) = _lhs (/) \(a :: _) (b :: _) -> _rhs (PrimDiv a b) |
515 | 563 | ||
516 | (%) = \(a :: _) (b :: _) -> _rhs (PrimMod a b) | 564 | (%) = _lhs (%) \(a :: _) (b :: _) -> _rhs (PrimMod a b) |
517 | 565 | ||
518 | neg = \(a :: _) -> _rhs (PrimNeg a) | 566 | neg = _lhs neg \(a :: _) -> _rhs (PrimNeg a) |
519 | 567 | ||
520 | (/=) = \(a :: _) (b :: _) -> _rhs (PrimNotEqual a b) | 568 | (/=) = _lhs (/=) \(a :: _) (b :: _) -> _rhs (PrimNotEqual a b) |
521 | 569 | ||
522 | (<) = \(a :: _) (b :: _) -> _rhs (PrimLessThan a b) | 570 | (<) = _lhs (<) \(a :: _) (b :: _) -> _rhs (PrimLessThan a b) |
523 | 571 | ||
524 | (<=) = \(a :: _) (b :: _) -> _rhs (PrimLessThanEqual a b) | 572 | (<=) = _lhs (<=) \(a :: _) (b :: _) -> _rhs (PrimLessThanEqual a b) |
525 | 573 | ||
526 | (>=) = \(a :: _) (b :: _) -> _rhs (PrimGreaterThanEqual a b) | 574 | (>=) = _lhs (>=) \(a :: _) (b :: _) -> _rhs (PrimGreaterThanEqual a b) |
527 | 575 | ||
528 | (>) = \(a :: _) (b :: _) -> _rhs (PrimGreaterThan a b) | 576 | (>) = _lhs (>) \(a :: _) (b :: _) -> _rhs (PrimGreaterThan a b) |
529 | 577 | ||
530 | (&&) = \(a :: _) (b :: _) -> _rhs (PrimAnd a b) | 578 | (&&) = _lhs (&&) \(a :: _) (b :: _) -> _rhs (PrimAnd a b) |
531 | 579 | ||
532 | (||) = \(a :: _) (b :: _) -> _rhs (PrimOr a b) | 580 | (||) = _lhs (||) \(a :: _) (b :: _) -> _rhs (PrimOr a b) |
533 | 581 | ||
534 | xor = _rhs PrimXor | 582 | xor = _lhs xor (_rhs PrimXor) |
535 | 583 | ||
536 | not = \(a :: _) -> _rhs (PrimNot a) | 584 | not = _lhs not \(a :: _) -> _rhs (PrimNot a) |
537 | 585 | ||
538 | any = \(a :: _) -> _rhs (PrimAny a) | 586 | any = _lhs any \(a :: _) -> _rhs (PrimAny a) |
539 | 587 | ||
540 | all = \(a :: _) -> _rhs (PrimAll a) | 588 | all = _lhs all \(a :: _) -> _rhs (PrimAll a) |
541 | 589 | ||
542 | (.*.) = \(a :: _) (b :: _) -> _rhs (PrimMulMatMat a b) | 590 | (.*.) = _lhs (.*.) \(a :: _) (b :: _) -> _rhs (PrimMulMatMat a b) |
543 | 591 | ||
544 | (*.) = \(a :: _) (b :: _) -> _rhs (PrimMulMatVec a b) | 592 | (*.) = _lhs (*.) \(a :: _) (b :: _) -> _rhs (PrimMulMatVec a b) |
545 | 593 | ||
546 | (.*) = \(a :: _) (b :: _) -> _rhs (PrimMulVecMat a b) | 594 | (.*) = _lhs (.*) \(a :: _) (b :: _) -> _rhs (PrimMulVecMat a b) |
547 | 595 | ||
548 | infixl 7 *! | 596 | infixl 7 *! |
549 | 597 | ||
@@ -555,118 +603,142 @@ infixl 6 +! | |||
555 | 603 | ||
556 | infixl 6 -! | 604 | infixl 6 -! |
557 | 605 | ||
558 | (+!) = \(a :: _) (b :: _) -> _rhs (PrimAddS a b) | 606 | (+!) = _lhs (+!) \(a :: _) (b :: _) -> _rhs (PrimAddS a b) |
559 | 607 | ||
560 | (-!) = \(a :: _) (b :: _) -> _rhs (PrimSubS a b) | 608 | (-!) = _lhs (-!) \(a :: _) (b :: _) -> _rhs (PrimSubS a b) |
561 | 609 | ||
562 | (*!) = \(a :: _) (b :: _) -> _rhs (PrimMulS a b) | 610 | (*!) = _lhs (*!) \(a :: _) (b :: _) -> _rhs (PrimMulS a b) |
563 | 611 | ||
564 | (/!) = \(a :: _) (b :: _) -> _rhs (PrimDivS a b) | 612 | (/!) = _lhs (/!) \(a :: _) (b :: _) -> _rhs (PrimDivS a b) |
565 | 613 | ||
566 | (%!) = \(a :: _) (b :: _) -> _rhs (PrimModS a b) | 614 | (%!) = _lhs (%!) \(a :: _) (b :: _) -> _rhs (PrimModS a b) |
567 | 615 | ||
568 | perspective | 616 | perspective |
569 | :: Float -> Float -> Float -> Float -> Mat (fromInt 4) (fromInt 4) Float | 617 | :: Float -> Float -> Float -> Float -> Mat (fromInt 4) (fromInt 4) Float |
570 | perspective | 618 | perspective |
571 | = \(a :: _) (b :: _) (c :: _) (d :: _) -> _rhs | 619 | = _lhs |
572 | let | 620 | perspective |
573 | e = _rhs (a * tan (c / fromInt 2)); | 621 | \(a :: _) (b :: _) (c :: _) (d :: _) -> _rhs |
574 | f = _rhs (fromInt 0 - e); | 622 | let |
575 | g = _rhs (d * e); | 623 | e = _lhs t (_rhs (a * tan (c / fromInt 2))); |
576 | h = _rhs (fromInt 0 - g) | 624 | f = _lhs b (_rhs (fromInt 0 - e)); |
577 | in M44F | 625 | g = _lhs r (_rhs (d * e)); |
578 | (V4 (fromInt 2 * a / (g - h)) (fromInt 0) (fromInt 0) (fromInt 0)) | 626 | h = _lhs l (_rhs (fromInt 0 - g)) |
579 | (V4 (fromInt 0) (fromInt 2 * a / (e - f)) (fromInt 0) (fromInt 0)) | 627 | in M44F |
580 | (V4 | 628 | (V4 (fromInt 2 * a / (g - h)) (fromInt 0) (fromInt 0) (fromInt 0)) |
581 | ((g + h) / (g - h)) | 629 | (V4 (fromInt 0) (fromInt 2 * a / (e - f)) (fromInt 0) (fromInt 0)) |
582 | ((e + f) / (e - f)) | 630 | (V4 |
583 | (fromInt 0 - (b + a) / (b - a)) | 631 | ((g + h) / (g - h)) |
584 | (fromInt 0 - fromInt 1)) | 632 | ((e + f) / (e - f)) |
585 | (V4 | 633 | (fromInt 0 - (b + a) / (b - a)) |
586 | (fromInt 0) | 634 | (fromInt 0 - fromInt 1)) |
587 | (fromInt 0) | 635 | (V4 |
588 | (fromInt 0 - fromInt 2 * b * a / (b - a)) | 636 | (fromInt 0) |
589 | (fromInt 0)) | 637 | (fromInt 0) |
638 | (fromInt 0 - fromInt 2 * b * a / (b - a)) | ||
639 | (fromInt 0)) | ||
590 | 640 | ||
591 | rotMatrixZ | 641 | rotMatrixZ |
592 | = \(a :: _) -> _rhs | 642 | = _lhs |
593 | let b = _rhs (cos a); c = _rhs (sin a) in M44F | 643 | rotMatrixZ |
594 | (V4 b c (fromInt 0) (fromInt 0)) | 644 | \(a :: _) -> _rhs |
595 | (V4 (fromInt 0 - c) b (fromInt 0) (fromInt 0)) | 645 | let b = _lhs c (_rhs (cos a)); c = _lhs s (_rhs (sin a)) in M44F |
596 | (V4 (fromInt 0) (fromInt 0) (fromInt 1) (fromInt 0)) | 646 | (V4 b c (fromInt 0) (fromInt 0)) |
597 | (V4 (fromInt 0) (fromInt 0) (fromInt 0) (fromInt 1)) | 647 | (V4 (fromInt 0 - c) b (fromInt 0) (fromInt 0)) |
648 | (V4 (fromInt 0) (fromInt 0) (fromInt 1) (fromInt 0)) | ||
649 | (V4 (fromInt 0) (fromInt 0) (fromInt 0) (fromInt 1)) | ||
598 | 650 | ||
599 | rotMatrixY | 651 | rotMatrixY |
600 | = \(a :: _) -> _rhs | 652 | = _lhs |
601 | let b = _rhs (cos a); c = _rhs (sin a) in M44F | 653 | rotMatrixY |
602 | (V4 b (fromInt 0) (fromInt 0 - c) (fromInt 0)) | 654 | \(a :: _) -> _rhs |
603 | (V4 (fromInt 0) (fromInt 1) (fromInt 0) (fromInt 0)) | 655 | let b = _lhs c (_rhs (cos a)); c = _lhs s (_rhs (sin a)) in M44F |
604 | (V4 c (fromInt 0) b (fromInt 0)) | 656 | (V4 b (fromInt 0) (fromInt 0 - c) (fromInt 0)) |
605 | (V4 (fromInt 0) (fromInt 0) (fromInt 0) (fromInt 1)) | 657 | (V4 (fromInt 0) (fromInt 1) (fromInt 0) (fromInt 0)) |
658 | (V4 c (fromInt 0) b (fromInt 0)) | ||
659 | (V4 (fromInt 0) (fromInt 0) (fromInt 0) (fromInt 1)) | ||
606 | 660 | ||
607 | rotMatrixX | 661 | rotMatrixX |
608 | = \(a :: _) -> _rhs | 662 | = _lhs |
609 | let b = _rhs (cos a); c = _rhs (sin a) in M44F | 663 | rotMatrixX |
610 | (V4 (fromInt 1) (fromInt 0) (fromInt 0) (fromInt 0)) | 664 | \(a :: _) -> _rhs |
611 | (V4 (fromInt 0) b c (fromInt 0)) | 665 | let b = _lhs c (_rhs (cos a)); c = _lhs s (_rhs (sin a)) in M44F |
612 | (V4 (fromInt 0) (fromInt 0 - c) b (fromInt 0)) | 666 | (V4 (fromInt 1) (fromInt 0) (fromInt 0) (fromInt 0)) |
613 | (V4 (fromInt 0) (fromInt 0) (fromInt 0) (fromInt 1)) | 667 | (V4 (fromInt 0) b c (fromInt 0)) |
668 | (V4 (fromInt 0) (fromInt 0 - c) b (fromInt 0)) | ||
669 | (V4 (fromInt 0) (fromInt 0) (fromInt 0) (fromInt 1)) | ||
614 | 670 | ||
615 | rotationEuler | 671 | rotationEuler |
616 | = \(a :: _) (b :: _) (c :: _) -> _rhs | 672 | = _lhs |
617 | (rotMatrixY a .*. rotMatrixX b .*. rotMatrixZ c) | 673 | rotationEuler |
674 | \(a :: _) (b :: _) (c :: _) -> _rhs | ||
675 | (rotMatrixY a .*. rotMatrixX b .*. rotMatrixZ c) | ||
618 | 676 | ||
619 | translateBefore4 :: Vec (fromInt 3) Float -> Mat (fromInt 4) (fromInt 4) Float | 677 | translateBefore4 :: Vec (fromInt 3) Float -> Mat (fromInt 4) (fromInt 4) Float |
620 | translateBefore4 | 678 | translateBefore4 |
621 | = \(a :: _) -> _rhs | 679 | = _lhs |
622 | let | 680 | translateBefore4 |
623 | b = _rhs (V4 (fromInt 1) (fromInt 0) (fromInt 0) (fromInt 0)); | 681 | \(a :: _) -> _rhs |
624 | c = _rhs (V4 (fromInt 0) (fromInt 1) (fromInt 0) (fromInt 0)); | 682 | let |
625 | d = _rhs (V4 (fromInt 0) (fromInt 0) (fromInt 1) (fromInt 0)); | 683 | b = _lhs r1 (_rhs (V4 (fromInt 1) (fromInt 0) (fromInt 0) (fromInt 0))); |
626 | e | 684 | c = _lhs r2 (_rhs (V4 (fromInt 0) (fromInt 1) (fromInt 0) (fromInt 0))); |
627 | = _rhs (V4 (swizzscalar a Sx) (swizzscalar a Sy) (swizzscalar a Sz) (fromInt 1)) | 685 | d = _lhs r3 (_rhs (V4 (fromInt 0) (fromInt 0) (fromInt 1) (fromInt 0))); |
628 | in M44F b c d e | 686 | e |
687 | = _lhs | ||
688 | r4 | ||
689 | (_rhs (V4 (swizzscalar a Sx) (swizzscalar a Sy) (swizzscalar a Sz) (fromInt 1))) | ||
690 | in M44F b c d e | ||
629 | 691 | ||
630 | lookat | 692 | lookat |
631 | :: Vec (fromInt 3) Float | 693 | :: Vec (fromInt 3) Float |
632 | -> Vec (fromInt 3) Float | 694 | -> Vec (fromInt 3) Float |
633 | -> Vec (fromInt 3) Float -> Mat (fromInt 4) (fromInt 4) Float | 695 | -> Vec (fromInt 3) Float -> Mat (fromInt 4) (fromInt 4) Float |
634 | lookat | 696 | lookat |
635 | = \(a :: _) (b :: _) (c :: _) -> _rhs | 697 | = _lhs |
636 | let | 698 | lookat |
637 | d | 699 | \(a :: _) (b :: _) (c :: _) -> _rhs |
638 | = \(i :: _) -> _rhs | 700 | let |
639 | (V4 (swizzscalar i Sx) (swizzscalar i Sy) (swizzscalar i Sz) (fromInt 0)); | 701 | d |
640 | e = _rhs (normalize $ a - b); | 702 | = _lhs |
641 | f = _rhs (normalize $ c `cross` e); | 703 | ext0 |
642 | g = _rhs (e `cross` f); | 704 | \(i :: _) -> _rhs |
643 | h | 705 | (V4 (swizzscalar i Sx) (swizzscalar i Sy) (swizzscalar i Sz) (fromInt 0)); |
644 | = _rhs | 706 | e = _lhs w (_rhs (normalize $ a - b)); |
645 | (transpose | 707 | f = _lhs u (_rhs (normalize $ c `cross` e)); |
646 | $ M44F (d f) (d g) (d e) (V4 (fromInt 0) (fromInt 0) (fromInt 0) (fromInt 1))) | 708 | g = _lhs v (_rhs (e `cross` f)); |
647 | in h .*. translateBefore4 (neg a) | 709 | h |
648 | 710 | = _lhs | |
649 | scale = \(a :: _) (b :: _) -> _rhs (b * V4 a a a 1.0) | 711 | r |
712 | (_rhs | ||
713 | (transpose | ||
714 | $ M44F (d f) (d g) (d e) (V4 (fromInt 0) (fromInt 0) (fromInt 0) (fromInt 1)))) | ||
715 | in h .*. translateBefore4 (neg a) | ||
716 | |||
717 | scale = _lhs scale \(a :: _) (b :: _) -> _rhs (b * V4 a a a 1.0) | ||
650 | 718 | ||
651 | fromTo :: Float -> Float -> [Float] | 719 | fromTo :: Float -> Float -> [Float] |
652 | fromTo | 720 | fromTo |
653 | = \(a :: _) (b :: _) -> case'Bool | 721 | = _lhs |
654 | (\(_ :: _) -> _) | 722 | fromTo |
655 | (_rhs (a : fromTo (a + fromInt 1) b)) | 723 | \(a :: _) (b :: _) -> case'Bool |
656 | (_rhs []) | 724 | (\(_ :: _) -> _) |
657 | (a > b) | 725 | (_rhs (a : fromTo (a + fromInt 1) b)) |
726 | (_rhs []) | ||
727 | (a > b) | ||
658 | 728 | ||
659 | (!!) :: forall (a :: _) . [a] -> Int -> a | 729 | (!!) :: forall (a :: _) . [a] -> Int -> a |
660 | (!!) | 730 | (!!) |
661 | = \(a :: _) (b :: _) -> case'List | 731 | = _lhs |
662 | (\(_ :: _) -> _) | 732 | (!!) |
663 | (_rhs undefined) | 733 | \(a :: _) (b :: _) -> case'List |
664 | (\(c :: _) (d :: _) -> case'Bool | ||
665 | (\(_ :: _) -> _) | 734 | (\(_ :: _) -> _) |
666 | (_rhs (d !! (b - fromInt 1))) | 735 | (_rhs undefined) |
667 | (_rhs c) | 736 | (\(c :: _) (d :: _) -> case'Bool |
668 | (fromInt 0 == b)) | 737 | (\(_ :: _) -> _) |
669 | a | 738 | (_rhs (d !! (b - fromInt 1))) |
739 | (_rhs c) | ||
740 | (fromInt 0 == b)) | ||
741 | a | ||
670 | ------------ core code | 742 | ------------ core code |
671 | !! :: forall a . [a] -> Int -> a | 743 | !! :: forall a . [a] -> Int -> a |
672 | !! | 744 | !! |