# Changes between Version 61 and Version 62 of DataParallel/ClosureConversion/ClassLess

Show
Ignore:
Timestamp:
05/03/07 03:37:42 (6 years ago)
Comment:

--

Unmodified
Removed
Modified
• ## DataParallel/ClosureConversion/ClassLess

v61 v62
133133                    iso<t1> iso<t2>
134134iso<t1 t2>      = iso<t1> iso<t2>
135 iso<forall a.t> = iso<t>
135iso<forall a.t> = toIso :<->: frIso
136  where
137    toIso (x::forall a.t) = /\a. to (iso<t>)@a x@a
138    frIso (x::forall a.t) = /\a. fr (iso<t>)@a x@a
136139}}}
137140where
138141{{{
139142idIso<*>      = id :<->: id
143}}}
144
145'''OPEN PROBLEM:''' What should `idIso<k>` do for `k` other than `*`?  We might think
146{{{
140147idIso<k1->k2> = \_ -> (idIso<k2>)
141148}}}
142
143 '''TODO:''' This doesn't work for types with constructor variables yet, as the `f (Int -> Int)` example below.  Roman has an example, where we actually do need a conversion of the `Int -> Int` to a closure.
149would work, but it doesn't always.  Take this example
150{{{
151data T a = MkT a
152unit :: T a -> a
153unit (MkT x) = x
154
155-- converted
156foo :: f (Int -> Int) -> (forall a. f a -> a) -> Int
157foo t u = u t 1
158
159-- not converted
160bar = foo unit
161}}}
162Here, we will have to convert the first argument to `foo` and that conversion needs to convert the embedded `Int -> Int` to `Int :-> Int`, which is hard to do in `foo = fr iso<...> foo_CC` as we don't know anything about `f::*->*`.
144163
145164==== Examples ====

151170iso<[a -> a]>       = isoList (isoArr (id :<->: id)
152171                                      (id :<->: id))
153 iso<f (Int -> Int)> = (\_ -> (id :<->: id))
154                         (isoArr isoInt isoInt)
155                     = id :<-> id
172iso<f (Int -> Int)> = ???
156173}}}
157174