[newbie] UTF-8

Ketil Z. Malde ketil@ii.uib.no
11 Aug 2003 09:07:47 +0200

Marcin 'Qrczak' Kowalczyk <qrczak@knm.org.pl> writes:

> Dnia pon 11. sierpnia 2003 00:49, Wolfgang Jeltsch napisa=B3:

>> The main problem is that you need binary I/O. Haskell 98 only provides t=
>> I/O.

> You don't need binary I/O for UTF-8 now; because implementations use=20
> ISO-8859-1, UTF-8 octets can be faked as characters by (chr . fromIntegra=

I wonder,

Would it cause a lot of compatibility trouble to wrap IO functions in
a class

    class IOData a where
        readFile :: FilePath -> a

and do

    instance IOData Char where ...
    instance IOData Word8 where ...

(Defaulting to Char the same way as Integer)

Would this let us start writing byte-based IO without sacrificing
compatibility or designing specific interfaces for it?

Perhaps one could even do record-based IO by declaring instantiation
IOData for custom data structures?

If I haven't seen further, it is by standing in the footprints of giants