What's wrong this this code?
Prelude> let xᵀ = "abc" <interactive>:10:6: lexical error at character '\7488'
According to my reading of the <a href="http://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-180002.4" rel="nofollow">Haskell 2010 report</a>, any uppercase or lowercase Unicode letter should be valid at the end of a variable name. Does the
ᵀ character (<a href="http://www.fileformat.info/info/unicode/char/1d40/index.htm" rel="nofollow">MODIFIER LETTER CAPITAL T</a>) not qualify as an uppercase Unicode letter?
Is there a better character to represent the transpose of a vector? I'd like to stay concise since I'm evaluating a dense mathematical formula.
I'm running GHC 7.8.3.Answer1:
Uppercase Unicode letters are in the Unicode character category Letter, Uppercase [Lu].
Lowercase Unicode letters are in the Unicode character category Letter, Lowercase [Ll].
MODIFIER LETTER CAPITAL T is in the Unicode character category Letter, Modifier [Lm].
I tend to stick to ASCII, so I'd probably just use a name like
x', depending on the number of lines it is in scope.
Characters not in the category ANY are not valid in Haskell programs and should result in a lexing error.</blockquote>
ANY → graphic | whitechar graphic → small | large | symbol | digit | special | " | ' small → ascSmall | uniSmall | _<br> ascSmall → a | b | … | z<br> uniSmall → any Unicode lowercase letter ... uniDigit → any Unicode decimal digit ...
Modifier letters like
ᵀ are not legal Haskell at all. (Unlike sub- or superscript <em>numbers</em> – which are in the <a href="http://www.fileformat.info/info/unicode/category/No/list.htm" rel="nofollow">Number, Other category</a> so
a₁ is treated much like
I like to use non-ASCII Unicode when it helps readability, but unless you've already assigned another meaning to the prime symbol using it here for transpose should be just fine.