Changes between Version 56 and Version 57 of DataParallel/ClosureConversion/ClassLess


Ignore:
Timestamp:
May 1, 2007 8:41:32 AM (8 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DataParallel/ClosureConversion/ClassLess

    v56 v57  
    2626data a :-> b = forall e. !(e -> a -> b) :$ e 
    2727}}} 
    28 and define closure application as 
    29 {{{ 
     28and define closure creation and application as 
     29{{{ 
     30lam :: (a -> b) -> (a :-> b) 
     31lam f = const f :$ () 
     32 
    3033($:) :: (a :-> b) -> a -> b 
    3134(f :$ e) $: x = f e x 
     
    277280==== Examples ==== 
    278281 
     282Given  
     283{{{ 
     284add :: Num a -> a -> a 
     285add = \dNum x -> (+) dNum x 1 
     286}}} 
     287we generate 
     288{{{ 
     289add :: Num a -> a -> a 
     290add = fr isoFun add_CC 
     291  where 
     292    isoFun = isoNum (id :<->: id) `isoArr` 
     293             (id :<->: id)        `isoArr` 
     294             (id :<->: id) 
     295 
     296add_CC :: Num_CC a :-> a :-> a 
     297add_CC = lam $ \dNum ->  
     298           (\dNum x -> (+_CC) dNum $: x $: 1) :$ dNum 
     299}}} 
     300Note how we have to be careful not to use `($:)` for field selection from the dictionary. 
     301 
     302=== Converting terms === 
    279303 
    280304---- 
    281305chak: revision front 
    282306---- 
    283  
    284 === Converting core terms === 
    285307 
    286308Apart from the standard rules, we need to handle the following special cases: