Changing the ghci prompt

i have been trying to change my prompt in ghci through the .ghci config file. I wanted it to prompt λ> but when i inserted this :set prompt "\x03BB> " into the file and ran ghci, it would then prompt me ?>. And i have checked my terminal does support unicode. I have also tried to just insert the lambda symbol directly instead of using the unicode

1 Like

I think this is due to a locale setting. I can reproduce this if I run LC_ALL=C ghci and then :set prompt "\x03BB> " and also putStrLn "\x03BB". You can try LC_ALL=C.UTF-8 ghci to see if that fixes your problem.

I don’t know a good way to properly fix this, maybe try searching for another locale that does support unicode.

Hello ramses,
I have got :set prompt "λ> " and it works, so maybe it is an
encoding problem? when I type :set encoding in vim I get
encoding=utf-8. What is yours?

when i type :set encoding in vim i get encoding =utf-8 aswell. But im not using ghci inside of vim. I just launch ghci in a separate window.

i tried running LC_ALL=C.UTF-8 ghci but this is what i get > /bin/sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)

Yeah, C.UTF-8 is not available on all platforms. You can see a list of the available locales with locale -a, then you can try one that ends in .UTF-8 or .utf8. If there is no such locale then you can generate one as described here in the Arch wiki for example.

1 Like

I found out that i had written en-US.utf8 in my locale.conf instead of en_US.utf8. Thx for the help

1 Like