[Haskell-cafe] Re: Sugestion for a basic Utf8 type.

Mauricio briqueabraque at yahoo.com
Tue Dec 2 13:17:36 EST 2008

 >   So  this  proposal  is  more   than  a  UTF8  type,  since  it
 >   encompasses a  move away from  text as lists.  What interfaces
 >   would we have to text in this proposal?

Normal users  would import modules with  specific interfaces, like
functions or instances.

One possible such  module would be Streams like  those sugested in
the  previous article.  Others could  offer functionality  I don't
know of  -- maybe there's  some usefull interface for  japanese or
greek users we (non japanese or greek) don't imagine.

My first attempt  would be PortugueseText, with a  type that could
only be built after Portuguese "primitives" or read from Utf8 with
possible errors,  and convert to  Utf8 of course. That  type would
always convert  to Utf8 with  correct diacriticals, and  sort with
the  latest Portuguese  agreements. Mapping  over syllables  could
be  allowed,  that  makes  sense in  syllabic  languages.  Quotes,
questions,  parenthesis etc.  could  be done  with functions  like
'quote «Ser ou não ser»'.

Other could be SimpleEnglishTextAsList, that could offer something
close  to what  we  have today,  with  functions for  uppercasing,
lowercasing and well behaved (non ambiguous) sorting.

Writers  of very  basic modules  would  have to  touch Utf8  using
Foreign.  So,  maybe  the  only  standard  interface  would  be  a
(ForeignPtr?) pointer to  a null terminated block  of memory. This
would make Foreign a new Prelude,  maybe. In the end, this is just
a basic block of memory that we can fill with utf-8 text, and that
serves as a common denominador.


More information about the Haskell-Cafe mailing list