[Haskell-beginners] Unicode Fanatic — How to use?
John M. Dlugosz
ngnr63q02 at sneakemail.com
Thu Mar 27 20:51:22 UTC 2014
I love using non-ASCII characters! Even my name, Długosz, needs Latin-2. My wife's name,
涛, doesn't even use Latin characters. I've inserted thousands of em and en dashes in
Wikipedia and can easily type at least three kinds of blank space.
When I was in a college class on programming theory, we studied Backus’s FP System and I
corresponded with John Backus to ask a question the prof couldn't handle, and he sent me
the TeX definitions he used, so my homework really did match the appearance of the
textbook. But that's another story. I managed to get my name in the Unicode 3 hardcopy book.
So, I relish the ability to use proper math symbols in Haskell.
Here is an example of what I've tried:
{-# LANGUAGE UnicodeSyntax #-}
import Prelude.Unicode
f x y = x∨y
result = f ∘ id
-- problem = ¬ True
Is the UnicodeSyntax pragma a different mechanism than the modules? Do I need to state
both, or do they clash, or work together, or what?
Do I need to list all the individual modules (up to 12 of them) as needed (see
http://hackage.haskell.org/package/base-unicode-symbols) or can they be brought in as one
easy chunk, as the package itself is one thing?
The compiler does not like the ¬ symbol, with or without the pragma.
http://hackage.haskell.org/package/base-unicode-symbols-0.2.2.4/docs/Prelude-Unicode.html
clearly shows it (the first one!) and it appears in the module source so presumably it
didn't choke there. I recall seeing that it is one of the "problematic" symbols but GHC
has some extensions.
OTOH, I read that λ can’t be made to work, which is sad. Maybe ⅄ (which is a symbol) can
be used instead?
More information about the Beginners
mailing list