Replacing "->"s with "→"s, "=>"s with "⇒"s and so on in Haskell
There's a GHC extension called UnicodeSyntax
that allows some Unicode alternatives for certain syntax. However, in general, Haskell source code is written in Unicode, so non-ASCII characters can be used in plain Haskell source code for identifiers and operators, even without any extension.
In the code snippet you include in your question, the author is using both facilities. They are using UnicodeSyntax
to allow the Unicode characters ∷
, ⇒
and →
in place of the built-in ::
, =>
and ->
syntax, but they are using the regular Haskell Unicode support to write α
and τ
for identifiers.
The following program is valid without any extension:
discount :: Floating α => α -> α -> α -> α
discount τ df x = x * (1 + df) ** (-τ)
From the GHC docs:
The language extension UnicodeSyntax enables Unicode characters to be used to stand for certain ASCII character sequences.