[Colin Paul Adams] Re: Proposal: Define UTF-8 to be the encoding of Haskell source files

Bas van Dijk v.dijk.bas at gmail.com
Wed Apr 6 20:02:23 CEST 2011


On 6 April 2011 17:34, Colin Paul Adams <colin at colina.demon.co.uk> wrote:
> I forgot to CC the list:
>
>>>>>> "Roel" == Roel van Dijk <vandijk.roel at gmail.com> writes:
>
>    Roel> I propose to make UTF-8 the only allowed encoding for Haskell
>    Roel> source files. Implementations must discard an initial Byte
>    Roel> Order Mark (BOM) if present [3].
>
>
>    Roel> * Pros - Ensures that Haskell source can be reliably exchanged
>    Roel> on the byte level.  - Disallows implicit ISO-8859-* encodings
>    Roel> in source code, ensuring portability.  - Little or no
>    Roel> implementation burden for compiler writers.
>
> Having thought this over a bit more, I don't think it's a good idea.
>
> Allowed? Allowed for what?

Allowed to be called a Haskell file.

If the report doesn't specify what a Haskell file is then we can't
reliably exchange Haskell source files by only looking at the files
themselves.

> What does it achieve? Nothing, as far as I can see. Authors will still
> be able to write their Haskell code in any encoding they like. And any
> compiler can have a front-end script with an option to specify the
> encoding used by source files, which simply uses iconv on the fly to
> translate.

Suppose I give you MyHaskellFile.hs. But before telling you how it's
encoded I go gliding (a hobby of mine). Unfortunately I crash my
glider and die :-(. Now what encoding option do you give to your
front-end script?

> I think the real place to mandate UTF-8 would be for Hackage. That's
> where it matters (an alternative design would be to add an encoding
> field in the .cabal file, but I don't think this has much merit).

That would only allow users of Hackage and Cabal to reliably exchange
their Haskell files. If we specify it in the report every user can
benefit.

Regards,

Bas



More information about the Haskell-prime mailing list