summaryrefslogtreecommitdiff
path: root/testdata/Prelude.out
diff options
context:
space:
mode:
authorPéter Diviánszky <divipp@gmail.com>2016-05-10 16:32:23 +0200
committerPéter Diviánszky <divipp@gmail.com>2016-05-10 16:32:23 +0200
commit6ecef8f577432ffcaee07f09b2a73d4ea5eb5de2 (patch)
tree82ed1f4401c3cf2cd4910e5f2e62d0d3a8ac6904 /testdata/Prelude.out
parente061e1a91afc552fd7c3d7e5f7efb59746cc446f (diff)
explicit lhs marks, first step
Diffstat (limited to 'testdata/Prelude.out')
-rw-r--r--testdata/Prelude.out834
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
13infixr 0 $ 13infixr 0 $
14 14
15const = \(a :: _) (_ :: _) -> _rhs a 15const = _lhs const \(a :: _) (_ :: _) -> _rhs a
16 16
17otherwise = _rhs True 17otherwise = _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
25uncurry 25uncurry
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
43pi = _rhs 3.141592653589793 47pi = _lhs pi (_rhs 3.141592653589793)
44 48
45zip :: forall (a :: _) (b :: _) . [a] -> [b] -> [(a, b)] 49zip :: forall (a :: _) (b :: _) . [a] -> [b] -> [(a, b)]
46zip 50zip
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
57unzip :: forall (a :: _) (b :: _) . [(a, b)] -> ([a], [b]) 63unzip :: forall (a :: _) (b :: _) . [(a, b)] -> ([a], [b])
58unzip 64unzip
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
97filter 109filter
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
106tail :: forall (a :: _) . [a] -> [a] 120tail :: forall (a :: _) . [a] -> [a]
107tail 121tail
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
114pairs :: forall (a :: _) . [a] -> [(a, a)] 130pairs :: forall (a :: _) . [a] -> [(a, a)]
115pairs = \(a :: _) -> _rhs (zip a (tail a)) 131pairs = _lhs pairs \(a :: _) -> _rhs (zip a (tail a))
116 132
117foldl' 133foldl'
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
124foldr1 142foldr1
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
131split 151split
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
161mergeBy 187mergeBy
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
179sortBy 207sortBy
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
191iterate :: forall (a :: _) . (a -> a) -> a -> [a] 221iterate :: forall (a :: _) . (a -> a) -> a -> [a]
192iterate = \(a :: _) (b :: _) -> _rhs (b : iterate a (a b)) 222iterate = _lhs iterate \(a :: _) (b :: _) -> _rhs (b : iterate a (a b))
193 223
194fst 224fst
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
203snd 235snd
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
214infixr 2 ||| 251infixr 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
218infixr 3 &&& 258infixr 3 &&&
219 259
@@ -221,255 +261,263 @@ data RecItem :: Type where
221 RecItem :: String -> Type -> RecItem 261 RecItem :: String -> Type -> RecItem
222 262
223recItemType 263recItemType
224 = \(a :: _) -> case'RecItem (\(_ :: _) -> _) (\(_ :: _) (b :: _) -> _rhs b) a 264 = _lhs
265 recItemType
266 \(a :: _) -> case'RecItem (\(_ :: _) -> _) (\(_ :: _) (b :: _) -> _rhs b) a
225 267
226data RecordC (_ :: [RecItem]) :: Type where 268data 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
229isKeyC 271isKeyC
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
240fstTup = _rhs (hlistConsCase (_ :: _) \(a :: _) (_ :: _) -> a) 284fstTup = _lhs fstTup (_rhs (hlistConsCase (_ :: _) \(a :: _) (_ :: _) -> a))
241 285
242sndTup = _rhs (hlistConsCase (_ :: _) \(_ :: _) (a :: _) -> a) 286sndTup = _lhs sndTup (_rhs (hlistConsCase (_ :: _) \(_ :: _) (a :: _) -> a))
243 287
244project 288project
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
247project 291project
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
271rgb = \(a :: _) (b :: _) (c :: _) -> _rhs (V4 a b c 1.0) 317rgb = _lhs rgb \(a :: _) (b :: _) (c :: _) -> _rhs (V4 a b c 1.0)
272 318
273black = _rhs (rgb 0.0 0.0 0.0) 319black = _lhs black (_rhs (rgb 0.0 0.0 0.0))
274 320
275gray = _rhs (rgb 0.5 0.5 0.5) 321gray = _lhs gray (_rhs (rgb 0.5 0.5 0.5))
276 322
277silver = _rhs (rgb 0.75 0.75 0.75) 323silver = _lhs silver (_rhs (rgb 0.75 0.75 0.75))
278 324
279white = _rhs (rgb 1.0 1.0 1.0) 325white = _lhs white (_rhs (rgb 1.0 1.0 1.0))
280 326
281maroon = _rhs (rgb 0.5 0.0 0.0) 327maroon = _lhs maroon (_rhs (rgb 0.5 0.0 0.0))
282 328
283red = _rhs (rgb 1.0 0.0 0.0) 329red = _lhs red (_rhs (rgb 1.0 0.0 0.0))
284 330
285olive = _rhs (rgb 0.5 0.5 0.0) 331olive = _lhs olive (_rhs (rgb 0.5 0.5 0.0))
286 332
287yellow = _rhs (rgb 1.0 1.0 0.0) 333yellow = _lhs yellow (_rhs (rgb 1.0 1.0 0.0))
288 334
289green = _rhs (rgb 0.0 0.5 0.0) 335green = _lhs green (_rhs (rgb 0.0 0.5 0.0))
290 336
291lime = _rhs (rgb 0.0 1.0 0.0) 337lime = _lhs lime (_rhs (rgb 0.0 1.0 0.0))
292 338
293teal = _rhs (rgb 0.0 0.5 0.5) 339teal = _lhs teal (_rhs (rgb 0.0 0.5 0.5))
294 340
295aqua = _rhs (rgb 0.0 1.0 1.0) 341aqua = _lhs aqua (_rhs (rgb 0.0 1.0 1.0))
296 342
297navy = _rhs (rgb 0.0 0.0 0.5) 343navy = _lhs navy (_rhs (rgb 0.0 0.0 0.5))
298 344
299blue = _rhs (rgb 0.0 0.0 1.0) 345blue = _lhs blue (_rhs (rgb 0.0 0.0 1.0))
300 346
301purple = _rhs (rgb 0.5 0.0 0.5) 347purple = _lhs purple (_rhs (rgb 0.5 0.0 0.5))
302 348
303fuchsia = _rhs (rgb 1.0 0.0 1.0) 349fuchsia = _lhs fuchsia (_rhs (rgb 1.0 0.0 1.0))
304 350
305colorImage1 = _rhs (ColorImage @(fromInt 1)) 351colorImage1 = _lhs colorImage1 (_rhs (ColorImage @(fromInt 1)))
306 352
307colorImage2 = _rhs (ColorImage @(fromInt 2)) 353colorImage2 = _lhs colorImage2 (_rhs (ColorImage @(fromInt 2)))
308 354
309depthImage1 = _rhs (DepthImage @(fromInt 1)) 355depthImage1 = _lhs depthImage1 (_rhs (DepthImage @(fromInt 1)))
310 356
311v3FToV4F :: Vec (fromInt 3) Float -> Vec (fromInt 4) Float 357v3FToV4F :: Vec (fromInt 3) Float -> Vec (fromInt 4) Float
312v3FToV4F 358v3FToV4F
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
316radians = _rhs PrimRadians 364radians = _lhs radians (_rhs PrimRadians)
317 365
318degrees = _rhs PrimDegrees 366degrees = _lhs degrees (_rhs PrimDegrees)
319 367
320sin = _rhs PrimSin 368sin = _lhs sin (_rhs PrimSin)
321 369
322cos = _rhs PrimCos 370cos = _lhs cos (_rhs PrimCos)
323 371
324tan = _rhs PrimTan 372tan = _lhs tan (_rhs PrimTan)
325 373
326sinh = _rhs PrimSinH 374sinh = _lhs sinh (_rhs PrimSinH)
327 375
328cosh = _rhs PrimCosH 376cosh = _lhs cosh (_rhs PrimCosH)
329 377
330tanh = _rhs PrimTanH 378tanh = _lhs tanh (_rhs PrimTanH)
331 379
332asin = _rhs PrimASin 380asin = _lhs asin (_rhs PrimASin)
333 381
334asinh = _rhs PrimASinH 382asinh = _lhs asinh (_rhs PrimASinH)
335 383
336acos = _rhs PrimACos 384acos = _lhs acos (_rhs PrimACos)
337 385
338acosh = _rhs PrimACosH 386acosh = _lhs acosh (_rhs PrimACosH)
339 387
340atan = _rhs PrimATan 388atan = _lhs atan (_rhs PrimATan)
341 389
342atanh = _rhs PrimATanH 390atanh = _lhs atanh (_rhs PrimATanH)
343 391
344atan2 = _rhs PrimATan2 392atan2 = _lhs atan2 (_rhs PrimATan2)
345 393
346pow = _rhs PrimPow 394pow = _lhs pow (_rhs PrimPow)
347 395
348exp = _rhs PrimExp 396exp = _lhs exp (_rhs PrimExp)
349 397
350log = _rhs PrimLog 398log = _lhs log (_rhs PrimLog)
351 399
352exp2 = _rhs PrimExp2 400exp2 = _lhs exp2 (_rhs PrimExp2)
353 401
354log2 = _rhs PrimLog2 402log2 = _lhs log2 (_rhs PrimLog2)
355 403
356sqrt = _rhs PrimSqrt 404sqrt = _lhs sqrt (_rhs PrimSqrt)
357 405
358inversesqrt = _rhs PrimInvSqrt 406inversesqrt = _lhs inversesqrt (_rhs PrimInvSqrt)
359 407
360abs = _rhs PrimAbs 408abs = _lhs abs (_rhs PrimAbs)
361 409
362sign = _rhs PrimSign 410sign = _lhs sign (_rhs PrimSign)
363 411
364floor = _rhs PrimFloor 412floor = _lhs floor (_rhs PrimFloor)
365 413
366trunc = _rhs PrimTrunc 414trunc = _lhs trunc (_rhs PrimTrunc)
367 415
368round = _rhs PrimRound 416round = _lhs round (_rhs PrimRound)
369 417
370roundEven = _rhs PrimRoundEven 418roundEven = _lhs roundEven (_rhs PrimRoundEven)
371 419
372ceil = _rhs PrimCeil 420ceil = _lhs ceil (_rhs PrimCeil)
373 421
374fract = _rhs PrimFract 422fract = _lhs fract (_rhs PrimFract)
375 423
376mod = _rhs PrimMod 424mod = _lhs mod (_rhs PrimMod)
377 425
378min = _rhs PrimMin 426min = _lhs min (_rhs PrimMin)
379 427
380max = _rhs PrimMax 428max = _lhs max (_rhs PrimMax)
381 429
382modF = _rhs PrimModF 430modF = _lhs modF (_rhs PrimModF)
383 431
384clamp = _rhs PrimClamp 432clamp = _lhs clamp (_rhs PrimClamp)
385 433
386clampS = _rhs PrimClampS 434clampS = _lhs clampS (_rhs PrimClampS)
387 435
388mix = _rhs PrimMix 436mix = _lhs mix (_rhs PrimMix)
389 437
390mixS = _rhs PrimMixS 438mixS = _lhs mixS (_rhs PrimMixS)
391 439
392mixB = _rhs PrimMixB 440mixB = _lhs mixB (_rhs PrimMixB)
393 441
394step = _rhs PrimStep 442step = _lhs step (_rhs PrimStep)
395 443
396stepS = _rhs PrimStepS 444stepS = _lhs stepS (_rhs PrimStepS)
397 445
398smoothstep = _rhs PrimSmoothStep 446smoothstep = _lhs smoothstep (_rhs PrimSmoothStep)
399 447
400smoothstepS = _rhs PrimSmoothStepS 448smoothstepS = _lhs smoothstepS (_rhs PrimSmoothStepS)
401 449
402isNan = _rhs PrimIsNan 450isNan = _lhs isNan (_rhs PrimIsNan)
403 451
404isInf = _rhs PrimIsInf 452isInf = _lhs isInf (_rhs PrimIsInf)
405 453
406dFdx = _rhs PrimDFdx 454dFdx = _lhs dFdx (_rhs PrimDFdx)
407 455
408dFdy = _rhs PrimDFdy 456dFdy = _lhs dFdy (_rhs PrimDFdy)
409 457
410fWidth = _rhs PrimFWidth 458fWidth = _lhs fWidth (_rhs PrimFWidth)
411 459
412noise1 = _rhs PrimNoise1 460noise1 = _lhs noise1 (_rhs PrimNoise1)
413 461
414noise2 = _rhs PrimNoise2 462noise2 = _lhs noise2 (_rhs PrimNoise2)
415 463
416noise3 = _rhs PrimNoise3 464noise3 = _lhs noise3 (_rhs PrimNoise3)
417 465
418noise4 = _rhs PrimNoise4 466noise4 = _lhs noise4 (_rhs PrimNoise4)
419 467
420length = _rhs PrimLength 468length = _lhs length (_rhs PrimLength)
421 469
422distance = _rhs PrimDistance 470distance = _lhs distance (_rhs PrimDistance)
423 471
424dot = _rhs PrimDot 472dot = _lhs dot (_rhs PrimDot)
425 473
426cross = _rhs PrimCross 474cross = _lhs cross (_rhs PrimCross)
427 475
428normalize = _rhs PrimNormalize 476normalize = _lhs normalize (_rhs PrimNormalize)
429 477
430faceforward = _rhs PrimFaceForward 478faceforward = _lhs faceforward (_rhs PrimFaceForward)
431 479
432reflect = _rhs PrimReflect 480reflect = _lhs reflect (_rhs PrimReflect)
433 481
434refract = _rhs PrimRefract 482refract = _lhs refract (_rhs PrimRefract)
435 483
436transpose = _rhs PrimTranspose 484transpose = _lhs transpose (_rhs PrimTranspose)
437 485
438det = _rhs PrimDeterminant 486det = _lhs det (_rhs PrimDeterminant)
439 487
440inv = _rhs PrimInverse 488inv = _lhs inv (_rhs PrimInverse)
441 489
442outer = _rhs PrimOuterProduct 490outer = _lhs outer (_rhs PrimOuterProduct)
443 491
444bAnd = _rhs PrimBAnd 492bAnd = _lhs bAnd (_rhs PrimBAnd)
445 493
446bOr = _rhs PrimBOr 494bOr = _lhs bOr (_rhs PrimBOr)
447 495
448bXor = _rhs PrimBXor 496bXor = _lhs bXor (_rhs PrimBXor)
449 497
450bNot = _rhs PrimBNot 498bNot = _lhs bNot (_rhs PrimBNot)
451 499
452bAndS = _rhs PrimBAndS 500bAndS = _lhs bAndS (_rhs PrimBAndS)
453 501
454bOrS = _rhs PrimBOrS 502bOrS = _lhs bOrS (_rhs PrimBOrS)
455 503
456bXorS = _rhs PrimBXorS 504bXorS = _lhs bXorS (_rhs PrimBXorS)
457 505
458shiftL = _rhs PrimBShiftL 506shiftL = _lhs shiftL (_rhs PrimBShiftL)
459 507
460shiftR = _rhs PrimBShiftR 508shiftR = _lhs shiftR (_rhs PrimBShiftR)
461 509
462shiftLS = _rhs PrimBShiftLS 510shiftLS = _lhs shiftLS (_rhs PrimBShiftLS)
463 511
464shiftRS = _rhs PrimBShiftRS 512shiftRS = _lhs shiftRS (_rhs PrimBShiftRS)
465 513
466floatBitsToInt = _rhs PrimFloatBitsToInt 514floatBitsToInt = _lhs floatBitsToInt (_rhs PrimFloatBitsToInt)
467 515
468floatBitsToWord = _rhs PrimFloatBitsToUInt 516floatBitsToWord = _lhs floatBitsToWord (_rhs PrimFloatBitsToUInt)
469 517
470intBitsToFloat = _rhs PrimIntBitsToFloat 518intBitsToFloat = _lhs intBitsToFloat (_rhs PrimIntBitsToFloat)
471 519
472wordBitsToFloat = _rhs PrimUIntBitsToFloat 520wordBitsToFloat = _lhs wordBitsToFloat (_rhs PrimUIntBitsToFloat)
473 521
474infixl 7 * 522infixl 7 *
475 523
@@ -505,45 +553,45 @@ infixl 7 .*
505 553
506infixl 7 .*. 554infixl 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
518neg = \(a :: _) -> _rhs (PrimNeg a) 566neg = _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
534xor = _rhs PrimXor 582xor = _lhs xor (_rhs PrimXor)
535 583
536not = \(a :: _) -> _rhs (PrimNot a) 584not = _lhs not \(a :: _) -> _rhs (PrimNot a)
537 585
538any = \(a :: _) -> _rhs (PrimAny a) 586any = _lhs any \(a :: _) -> _rhs (PrimAny a)
539 587
540all = \(a :: _) -> _rhs (PrimAll a) 588all = _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
548infixl 7 *! 596infixl 7 *!
549 597
@@ -555,118 +603,142 @@ infixl 6 +!
555 603
556infixl 6 -! 604infixl 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
568perspective 616perspective
569 :: Float -> Float -> Float -> Float -> Mat (fromInt 4) (fromInt 4) Float 617 :: Float -> Float -> Float -> Float -> Mat (fromInt 4) (fromInt 4) Float
570perspective 618perspective
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
591rotMatrixZ 641rotMatrixZ
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
599rotMatrixY 651rotMatrixY
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
607rotMatrixX 661rotMatrixX
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
615rotationEuler 671rotationEuler
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
619translateBefore4 :: Vec (fromInt 3) Float -> Mat (fromInt 4) (fromInt 4) Float 677translateBefore4 :: Vec (fromInt 3) Float -> Mat (fromInt 4) (fromInt 4) Float
620translateBefore4 678translateBefore4
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
630lookat 692lookat
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
634lookat 696lookat
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
649scale = \(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
717scale = _lhs scale \(a :: _) (b :: _) -> _rhs (b * V4 a a a 1.0)
650 718
651fromTo :: Float -> Float -> [Float] 719fromTo :: Float -> Float -> [Float]
652fromTo 720fromTo
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!!