Andrey Bushman
Andrey Bushman

Reputation: 12516

How can I use mathematic symbols (function name) in the ghci?

I'm learning Haskell. I see an author uses some mathematic unicode chars in the code here ( for example). I try use it too, for example:

(∀) :: (a -> b) -> [a] -> [b]
f ∀ [] = []
f ∀ (x:xs) = f x : f ∀ xs

ghci loads this sucessfully, but I can't call this function... When I try paste the symbol into ghci console from the clipboard, nothing happens (Windows 7, Lucida console font).

It is very convenient - to use mathematic symbols (in my opinion). How can I use it in the ghci?

Upvotes: 2

Views: 214

Answers (1)

Bartek Banachewicz
Bartek Banachewicz

Reputation: 39390

The most common way of getting the visuals of that is using a font and a text editor that supports ligatures, like Hasklig. That way it looks like you want it to, but it's saved as a regular ASCII file, which makes it much easier to work with with tools that don't support that technology.

I would recommend against using actual non-ASCII characters as identifiers; it might be common in Agda, but it can get simply annoying when trying to work on the same code with multiple people, on different platforms, and so on.

Upvotes: 1

Related Questions