
tor 2002-08-08 klockan 13.25 skrev ck15:
Hi, Is there a way to include symbols like set union , set intersection etc in Haskell code ?
Reference from http://www.haskell.org/onlinereport/lexemes.html (Haskell 98 report) "Haskell uses a pre-processor to convert non-Unicode character sets into Unicode. This pre-processor converts all characters to Unicode and uses the escape sequence \uhhhh, where the "h" are hex digits, to denote escaped Unicode characters. Since this translation occurs before the program is compiled, escaped Unicode characters may appear in identifiers and any other place in the program." So, you should be able to use the following: \u222a = set union \u2229 = set intersection etc. These characters should be allowed as operators, since they are unicode symbols, but neither ghc 5.04, hugs December 2001 or nhc98 1.14 accepts this syntax. As a matter of fact they all complain about an unexpected \. I couldn't find any compiler flag to make it compile either. The programs tested was a \u222a b = undefined I also tested the more normal \u0061 = undefined but none worked. Am I wrong here or is nobody following the standard? Another question is what happens to layout with these characters (6 spaces or 1?). Would it be feasible to allow, say, UTF-8 input instead, by some pragma or compiler flag? Would be very slick, since many editors support UTF-8, but not many support the \uhhhh notation. Same problem with layout of course. Regards, Martin -- Martin Norbäck d95mback@dtek.chalmers.se Kapplandsgatan 40 +46 (0)708 26 33 60 S-414 78 GÖTEBORG http://www.dtek.chalmers.se/~d95mback/ SWEDEN OpenPGP ID: 3FA8580B