Changes between Version 56 and Version 57 of DataParallel/ClosureConversion/ClassLess
- Timestamp:
- 05/01/07 01:41:32 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DataParallel/ClosureConversion/ClassLess
v56 v57 26 26 data a :-> b = forall e. !(e -> a -> b) :$ e 27 27 }}} 28 and define closure application as 29 {{{ 28 and define closure creation and application as 29 {{{ 30 lam :: (a -> b) -> (a :-> b) 31 lam f = const f :$ () 32 30 33 ($:) :: (a :-> b) -> a -> b 31 34 (f :$ e) $: x = f e x … … 277 280 ==== Examples ==== 278 281 282 Given 283 {{{ 284 add :: Num a -> a -> a 285 add = \dNum x -> (+) dNum x 1 286 }}} 287 we generate 288 {{{ 289 add :: Num a -> a -> a 290 add = fr isoFun add_CC 291 where 292 isoFun = isoNum (id :<->: id) `isoArr` 293 (id :<->: id) `isoArr` 294 (id :<->: id) 295 296 add_CC :: Num_CC a :-> a :-> a 297 add_CC = lam $ \dNum -> 298 (\dNum x -> (+_CC) dNum $: x $: 1) :$ dNum 299 }}} 300 Note how we have to be careful not to use `($:)` for field selection from the dictionary. 301 302 === Converting terms === 279 303 280 304 ---- 281 305 chak: revision front 282 306 ---- 283 284 === Converting core terms ===285 307 286 308 Apart from the standard rules, we need to handle the following special cases:
