unicode characters in operator name

Hi-- I'm creating a family of methods for a class, and to prevent name clashes I've annotated the function names with º. The files are saved UTF-8, so the character is accepted. Method names of the form fº are handled fine. GHC consumes them quite happily. Where I'm having trouble is in operator names. I'd like to create the operator (*º) but I get a type error: Invalid type signature for this line: (*º) :: (Real b, Floating b) => b -> a -> a I've tried other (ascii) symbol combinations and they're accepted, so I think the general form of my type declaration is fine. If I read the Haskell Report correctly, operators are named by (symbol {symbol | : }), where symbol is either an ascii symbol (including *) or a unicode symbol (defined as any Unicode symbol or punctuation). I'm pretty sure º is a unicode symbol or punctuation. I know I could get around this by using a different name, but this naming convention is more intuitive for what I'm trying to do. Am I misinterpreting the report, or am I doing something else wrong? Thanks-- Greg

On Saturday 11 September 2010 03:12:11, Greg wrote:
If I read the Haskell Report correctly, operators are named by (symbol {symbol | : }), where symbol is either an ascii symbol (including *) or a unicode symbol (defined as any Unicode symbol or punctuation). I'm pretty sure º is a unicode symbol or punctuation.
No, Prelude Data.Char> generalCategory 'º' LowercaseLetter weird, but that's how it is. If it were a symbol or punctuation, you couldn't use it in function names like fº.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 9/10/10 21:39 , Daniel Fischer wrote:
On Saturday 11 September 2010 03:12:11, Greg wrote:
a unicode symbol (defined as any Unicode symbol or punctuation). I'm pretty sure º is a unicode symbol or punctuation.
Prelude Data.Char> generalCategory 'º' LowercaseLetter
weird, but that's how it is. If it were a symbol or punctuation, you couldn't use it in function names like fº.
"Weird", but that's how Spanish at least treats it; it's a visually distinct lowercase "o" (along with the visually distinct lowercase "a", "ª") which indicates gender on an abbreviated ordinal ("primero" => "1º", "primera" => "1ª"; by convention they are raised, but "1o"/"1a" are equally valid). - -- brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyK37UACgkQIn7hlCsL25XPcACgmOhZ/0rM05l1/bPQ2EJNLZZS 87UAoIeyBNAefnbctVB0Ld7hrovRX4R5 =Qyau -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 9/10/10 21:12 , Greg wrote:
unicode symbol (defined as any Unicode symbol or punctuation). I'm pretty sure º is a unicode symbol or punctuation.
No, it's a raised lowercase "o" used by convention to indicate gender of abbreviated ordinals. You probably want U+00B0 DEGREE SIGN instead of U+00BA MASCULINE ORDINAL INDICATOR. - -- brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyK4CEACgkQIn7hlCsL25VOngCgu5qkmMzgIw/yBd6G3EikXT88 6AkAoKDXh+NIuN5XgT6A/vA0FVkFfsnJ =NOt1 -----END PGP SIGNATURE-----

Oh cripe... Yet another reason not to use funny symbols-- even the developer can't tell them apart!
Yeah, I wanted a degree sign, but if it's all that subtle then I should probably reconsider the whole idea.
On the positive side, I know what ª is for now so today wasn't a complete waste. =)
Thanks--
Greg
On Sep 10, 2010, at 06:49 PM, Brandon S Allbery KF8NH
unicode symbol (defined as any Unicode symbol or punctuation). I'm pretty sure º is a unicode symbol or punctuation.
No, it's a raised lowercase "o" used by convention to indicate gender of abbreviated ordinals. You probably want U+00B0 DEGREE SIGN instead of U+00BA MASCULINE ORDINAL INDICATOR. - -- brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.010 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyK4CEACgkQIn7hlCsL25VOngCgu5qkmMzgIw/yBd6G3EikXT88 6AkAoKDXh+NIuN5XgT6A/vA0FVkFfsnJ =NOt1 -----END PGP SIGNATURE----- _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (3)
-
Brandon S Allbery KF8NH
-
Daniel Fischer
-
Greg