2

I want to use Unicode characters from the Nerd Fonts for my workspaces in Xmonad.

myWorkspaces = ["1:", "2:", "3:", "4:", "5:", "6:ﱘ", "7:", "8:", "9:"]

For reference:

Array of workspace Unicode names

However, I get the following error on compilation:

xmonad.hs:191:13: error:
    lexical error in string/character literal at character '\62057'
    |
191 |         ["1:", "2:", "3:", "4:", "5:", "6:ﱘ", "7:", "8:", "9:"]
    |             ^

Please check the file for errors.

Warning: Missing charsets in String to FontSet conversion 

Is there any chance to use a full set of nerd fonts unicode characters? I have seen that others use a subset of unicode in their config.

loki
  • 9,816
  • 7
  • 56
  • 82
  • What is the encoding of your source files? Have you tried to specify the symbols with escape sequence? – max630 Mar 14 '20 at 13:09
  • @max630, I am using `file -i xmonad.hs: xmonad.hs: text/plain; charset=utf-8`. What would be the escape sequence? – loki Mar 14 '20 at 14:45

1 Answers1

7

I think you're running into GHC bug #5518. As a workaround, try the escape syntax instead (e.g., "1:\62057" or "1:\xf269" instead of "1:").

  • awesome, thanks. You could add that that it is easy to use the second approach and extracting the hex value from nerdfonts.com – loki Mar 14 '20 at 14:56
  • 2
    Maybe worth noting that, while this is *related* to bug #5518, this behavior isn't actually a bug. The Haskell standards and GHC require that string literals contain only "graphic" unicode characters (letters, marks, numbers, punctation, symbols. and spaces, corresponding to Unicode categories L, M, N, P, S, and Zs, and that excludes most of the characters above (which are designated as "private use" or category Co). – K. A. Buhr Mar 14 '20 at 17:10
  • @K.A.Buhr I'd argue that it's still a bug, just a bug in the standard rather than in the implementation. – Joseph Sible-Reinstate Monica Mar 14 '20 at 17:25