| 7 | | After some brainstorming, Roman and I (= Manuel) came to the conclusion that we can save ourselves a lot of bookkeeping if we can represent closure-converted types by indexed types (i.e., keeping track of which original types correspond to which converted types). The idea is to use a class |
| 8 | | {{{ |
| 9 | | class CC a where |
| 10 | | data CConv a -- closure converted 'a' |
| 11 | | to :: a -> CConv a |
| 12 | | fr :: CConv a -> a |
| 13 | | }}} |
| 14 | | The most interesting instance is that for functions, which reads |
| 15 | | {{{ |
| 16 | | data Clo a b = forall e. Clo (c -> a -> b) e |
| 17 | | |
| 18 | | class (CC a, CC b) => CC (a -> b) where |
| 19 | | data CConv (a -> b) = CCArrow (Clo a b) |
| 20 | | to f = Clo (\_ -> f) () |
| 21 | | fr (Clo f e) = f e |
| 22 | | }}} |
| | 7 | After some brainstorming, Roman and I (= Manuel) came to the conclusion that we can save ourselves a lot of bookkeeping if we can represent closure-converted types by indexed types (i.e., keeping track of which original types correspond to which converted types). The details are under [wiki:DataParallel/ClosureConversion/Indexed indexed closure conversion]. |