On Linux I input special characters using the Compose key. Works everywhere, not just in Vim.
Writing prettier Haskell with Unicode syntax and Vim
21–30 of 62 posts
Re: Writing prettier Haskell with Unicode syntax and Vim
#22I’d like to voice the contrarian opinion that, as someone who isn’t a mathematician, these symbols make the code look like gibberish to me. I had to squint to even see the circle on the end of the lollipop symbol, no way I’m not mistaking that for a hyphen. I don’t know the names for these symbols, so my brain has to 1) learn new images, 2) pattern match them throughout the code. I would be totally lost. If the code…
> ∀ instead of forall, which is faster to input than the whole word.
It reminds me of the idiom that code is often written once but read often, so one would want to optimize for readability and not fewer keystrokes. At least for production code.
Re: Writing prettier Haskell with Unicode syntax and Vim
#23I agree that this is very pretty, but font support is absolutely critical if you're going to do this.
[0] https://fonts.google.com/specimen/Roboto+Mono/glyphsRe: Writing prettier Haskell with Unicode syntax and Vim
#24You can also insert unicode using XCompose (WinCompose on windows). The benefit is that this ability carries to other applications as well, which is pretty nice. I for one like to communicate about math over text channels like discord.
Re: Writing prettier Haskell with Unicode syntax and Vim
#25Possibly a better way to achieve a similar level of prettiness would be (ab)use of vim's conceal feature. Through its judicious use, the author can have "forall" appear to them as ∀, "alpha" as α, etc., without imposing these symbols on their colleagues.
Agree, there is definitely a trade-off, I certainly don't know how to input those characters quickly even if the author states it is faster in Vim and I am not a Vim newbie. Also, if you get a stacktrace in a log file, do they still print nicely? Do they still print nicely if I'm viewing that stacktrace on a build server's web interface? There are probably some number of utilities that this code is "viewed" by that d…
Re: Writing prettier Haskell with Unicode syntax and Vim
#26I’d like to voice the contrarian opinion that, as someone who isn’t a mathematician, these symbols make the code look like gibberish to me. I had to squint to even see the circle on the end of the lollipop symbol, no way I’m not mistaking that for a hyphen. I don’t know the names for these symbols, so my brain has to 1) learn new images, 2) pattern match them throughout the code. I would be totally lost. If the code…
I agree. I read this line: > ∀ instead of forall, which is faster to input than the whole word. It reminds me of the idiom that code is often written once but read often, so one would want to optimize for readability and not fewer keystrokes. At least for production code.
Otherwise it would be like asserting that programming would be better if we eschewed all specific jargon. Why say "bit" when we can say "single digit for which there are only 2 possible values"?
Re: Writing prettier Haskell with Unicode syntax and Vim
#27I’d like to voice the contrarian opinion that, as someone who isn’t a mathematician, these symbols make the code look like gibberish to me. I had to squint to even see the circle on the end of the lollipop symbol, no way I’m not mistaking that for a hyphen. I don’t know the names for these symbols, so my brain has to 1) learn new images, 2) pattern match them throughout the code. I would be totally lost. If the code…
I agree. I read this line: > ∀ instead of forall, which is faster to input than the whole word. It reminds me of the idiom that code is often written once but read often, so one would want to optimize for readability and not fewer keystrokes. At least for production code.
∀ might be just as incomprehensible as OOP for a starting programmer, but for anyone taking even a small amount of time to learn it is not difficult at all.
Re: Writing prettier Haskell with Unicode syntax and Vim
#28I think the fact that the author somehow thinks that Greek letters are prettier and easier to understand hints at an enormous bias. Many people would not know their names, most people are probably unfamiliar to Greek letters beyond beta or gamma, with some exceptions for pi, which has the dubious property of being confusingly ambiguous if the constant is meant or a simple high-brow variation on a variable named p. It…
It's not like programming is completely devoid of terms of the art already. What's a Class? or an Object? or a Map? Etc. Etc.
Re: Writing prettier Haskell with Unicode syntax and Vim
#29Possibly a better way to achieve a similar level of prettiness would be (ab)use of vim's conceal feature. Through its judicious use, the author can have "forall" appear to them as ∀, "alpha" as α, etc., without imposing these symbols on their colleagues.
Agree, there is definitely a trade-off, I certainly don't know how to input those characters quickly even if the author states it is faster in Vim and I am not a Vim newbie. Also, if you get a stacktrace in a log file, do they still print nicely? Do they still print nicely if I'm viewing that stacktrace on a build server's web interface? There are probably some number of utilities that this code is "viewed" by that d…
Re: Writing prettier Haskell with Unicode syntax and Vim
#30Unicode in code might be what pushes people to consider variable-width font. Just look at the simple arrow in a text editor (hopefully the text filter on this website thinks this symbol is OK): → (U+2192 RIGHTWARDS ARROW). It’s tiny. And I notice that the author uses plain `->`. You do need at least an “em” width for that kind of symbol. But I wouldn’t want a normal variable-width font where colons are tiny and at-si…