[Haskell-cafe] Re: Versioning
Ross Paterson
ross at soi.city.ac.uk
Wed Dec 20 13:52:20 EST 2006
On Wed, Dec 20, 2006 at 07:30:02PM +0100, Joachim Durchholz wrote:
> Neil Mitchell schrieb:
> >You seem to be describing SYB and not knowing it:
> >http://homepages.cwi.nl/~ralf/syb1/
> >
> >That basically does exactly what you've requested, in terms of
> >traversing all items when only one matters.
>
> Yup, that's exactly what I was looking for. Actually I had seen it a
> while ago, but didn't remember it now. Thanks.
You spoke of changing each element to something of a different type.
I don't think SYB can do that. A solution (and a portable one too) might
be to parameterize all these types, and make them instances of Functor,
Foldable and Traversable (see Data.Foldable and Data.Traversable in
the GHC 6.6 documentation). You'd have the labour or writing all those
instances (though the trivial instances of Functor and Foldable would
suffice). But once you've done that, a range of different traversals
would be available.
> It might be not feasible though. The papers mention that you can't
> serialize (well, actually unserialize) function values with it. For the
> envisioned update-through-marshalling process, this would prevent me
> from ever using function values in data that needs to be persistent, and
> that's quite a harsh restriction.
That's hard to avoid, unless you have a data representation of the
functions you're interested in.
More information about the Haskell-Cafe
mailing list