[Haskell-cafe] Re: could we get a Data instance for Data.Text.Text?

Jeremy Shaw jeremy at n-heptane.com
Sat Jan 23 17:57:49 EST 2010


 On Sat, Jan 23, 2010 at 7:57 AM, Neil Mitchell <ndmitchell at gmail.com>wrote:


> No, that's definitely not correct, or even remotely scalable as we
> increase the number of abstract types in disparate packages.


Yes.. happstack is facing another aspect of this scalability issue as well.
We have a class, Serialize, which is used to serialize and deserialize data.
It builds on the binary library, but adds the ability to version your data
types and migrate data from older versions to newer versions.

This has a serious scalability issue though, because it requires that each
type a user might want to serialize has a Serialize instance.

So do we:

  1. provide Serialize instances for as many data types from libraries on
hackage as we can, resulting in depending on a large number of packages that
people are required to install, even though they will only use a small
fraction of them.

  2. convince people that Serialize deserves the same status as Data, and
then convince authors to create Serialize instances for their type? It would
be nice, but authors will start complaining if they are asked to provide a
zillion other instances for their types as well. And they will be annoyed if
they their library has to depend on a bunch of other libraries, just so they
can provide some instances that only a small fraction of their users might
use. So, this method does not scale as the number of 'interesting' classes
grows.

  3. let individual users define the Serialize instances as they need them.
Unfortunately, if two different library authors defined a Serialize instance
for Text in their libraries, you could not use both libraries in your
application because of the conflicting Serialize instances. So this method
does not scale when the number of libraries using the Serialize class grows.

Not really sure what the work around is. #1 could work if there was some way
to just selectively install the pieces as you need them. But the only way to
do this now would be to create a lot of cabal packages which just defined a
single instance -- happstack-text, happstack-map, happstack-time,
happstack-etc. One for each package that has types we want to create a
serialization instance for...

Any other suggestions?

- jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100123/f0e57faf/attachment.html


More information about the Haskell-Cafe mailing list