[Hs-Generics] compositional gMap in SYB1
oleg at okmij.org
oleg at okmij.org
Tue Jul 29 03:51:35 EDT 2008
Hello!
Claus wrote:
> Perhaps we can combine our versions to get the best of both?
I have done so. I have committed a new version of
/comparison/SYB1_2/GMap.lhs
with gmap2 of the type
> gmap2 :: forall a b c . (Data a, Data b,
> Data (c a), Data (c b), Data (c X)) =>
> (a -> b) -> c a -> c b
The compositionality tests seem to pass. There are no unsafe
operations or any unsafe extensions. Only standard Data.Typeable and
Generics.Data operations are being used. The code also contains an
optimization: if it is determined that a structured value has no
components to map, no traversal is performed and the value is returned
as it is. That should speed things up a little. The trick is producing
something out of nothing.
Too bad that the deadline to amend a Haskell workshop paper
has passed, and so has the deadline for the generics workshop. Perhaps
we should write a separate paper?
I'm afraid I would be out of town again for two weeks and so
would not be able to follow the discussion closely.
Cheers,
Oleg
More information about the Generics
mailing list