[Haskell-cafe] ANN: text 0.5, a major revision of the Unicode text library

Neil Brown nccb2 at kent.ac.uk
Sun Oct 11 09:58:51 EDT 2009

Bryan O'Sullivan wrote:
> On Fri, Oct 9, 2009 at 8:33 AM, Jeremy Shaw <jeremy at n-heptane.com 
> <mailto:jeremy at n-heptane.com>> wrote:
>     What are the chances of seeing a, instance Data Text, some day?
> I might as well follow up here, since I've sent Jeremy a couple of 
> messages on this subject.
> I think maybe someone else will have to take a crack at a Data 
> instance for Text, because the documentation for Data.Data is not 
> written in English. In its syntax and structure, it closely hews to 
> what we think of as English, but it is the kind of documentation that 
> can only be understood by someone who already knows what it is going 
> to say.
> This is an exemplar of my experience with the cottage industry of 
> generic programming in Haskell: I'd really quite like to use the 
> stuff, but for goodness's sake, o beloved researchers, please aim your 
> expository papers at non-specialists once in a while. An endless chain 
> of papers of the form "my technique, which you won't understand, is 
> better than this other technique, which you haven't read about and 
> won't anyway understand, in subtle ways that you won't understand" 
> does not feel to me like progress.
Data is probably the most complex bit of Haskell I've seen, and pretty 
much needs a full paper to have an idea of what's going on, so I'm not 
sure it's a typical piece of Haskell (nor even a typical bit of generic 
programming) to pick on.

I had a crack at a simple proper Data instance, and got as far as 
needing a Data instance for ByteString#, accompanied by an error I don't 
fully understand, but I think is telling me that things involving magic 
hashes are magic:

    Couldn't match kind `#' against `*'
    When matching the kinds of `ByteArray# :: #' and `d :: *'
      Expected type: d
      Inferred type: ByteArray#
    In the first argument of `z', namely `Array'

What is the Data instance required for here, exactly?  Is it generic 
transformations, or for generic serialisation (or some other need)?  It 
may be possible to fake the Data instance to cover the needed aspects.  
I'm not in favour of the boxing/unboxing that Jeremy suggested, because 
Text doesn't really contain a String, but I'm also not sure that a real 
Data instance (exposing all the innards) is that great either.

By the way: text-0.5 doesn't build for me on my GHC 6.8.2 system with 
base-3, mainly because you are assuming the class-based exception 
mechanism from base-4 in the Data.Text.Encoding.Error module, without 
using the extensible-exceptions package.  I'm happy to knock up some 
patches that fixes it, if you still want to support that configuration?



More information about the Haskell-Cafe mailing list