[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] Language simplicity

Subject: Re: [Haskell-cafe] Language simplicity
From: Roel van Dijk
Date: Thu, 14 Jan 2010 11:38:57 +0100
2010/1/14 Evan Laforge <[email protected]>:
> Wow, that's kind of cute:
> {-# LANGUAGE UnicodeSyntax #-}
> (ï) = (*)
> (ï) = (/)
> åå é ä ä = é ï ä ï ä ï ææ
> ææ = 123

That code snippet is also perfectly legal Haskell without the
UnicodeSyntax language extension. You use UnicodeSyntax if you want to
write code like this:

{-# LANGUAGE UnicodeSyntax, ScopedTypeVariables #-}
swap â â Î Î. (Î, Î) â (Î, Î)
swap = uncurry $ flip (,)

> Oddly, if I change the order of these definitions I get syntax
> errors.  Very mysterious.  Nice how it knows that ï is a symbol,
> but I'm not sure how I'm supposed to name a type.

I was a bit surprised that you could use ï as an operator since it is
a punctuation character. Maybe there are some corner cases with
fullwidth characters or with composition of characters.

> Unicode identifiers are fun but this is a good point.  The line has
> to be somewhere, so it might as well be in the historical position
> unless there are widely agreed on benefits to moving it.

I have already crossed that line:


But I am aware that there is a point beyond which unicode symbols only
make your code harder to understand. So I try to be conservative in my
use of them. Still, there are a lot of useful and acceptable symbols
which are not part of the historic ASCII set: â, â, â, â, Â, â to name
a few.
Haskell-Cafe mailing list
[email protected]

<Prev in Thread] Current Thread [Next in Thread>